Issues with recognized column types in integrations

This is an older issue, but still very much present, and becoming more and more an obstacle. I had reported several months ago to @yang regarding issues with column types in integration query windows. At the time, it was with an integration with Airtable, this time is with an integration with a Postgres database.

The issue is with the way Plasmic detects or recognizes data types of the respective api. With Airtable, it wouldn’t recognize certain columns, like Attachment fields. Now with the Postgres DB, it doesn’t recognize fields of type ENUM and JSON (and possibly others), the values of which are simple strings.

For example, in the Postgres DB table I have a “status” field of type ENUM that can be one of three options: “approved,pending,rejected”. So each row in the table will hold one of these. Because Plasmic doesn’t recognize these field types, I am unable to create a query to fetch rows with a certain status, because that field does not appear for selection in the filter’s Add Rule dropdown.

This forces me to write a custom SQL query inside an input field that is too small to type/edit queries in. So the entire experience is very painful, instead of being as simple as three clicks: Click to Add Rule, Click to select field, type in the desired value.

In the Postgres DB, I also have a field of type JSON, which simply holds a JSON object/string. Since the field is not recognized, I cannot “use integrations” that create or update rows, because the fields are missing from the list of fields that can be “filled”, which again forces me to write custom SQL queries for write operations, which frankly I would rather not. Or, it forces me to change my DB field type to string, which would make it visible on the Plasmic side but create other inconveniences in other areas and the other platforms.

This is very limiting and in many ways blocking for me, as I cannot conveniently create forms and interfaces in Plasmic for all the required purposes. So at this time, I am embedding external forms from other platforms instead of building everything out in Plasmic.

A solution for this could be as simple as showing all available fields in integrations windows, regardless of their type, or at least provide an option like “Show unknown fields” in a manner similar to how dynamic value windows have a “Show advanced fields” option.

Can this be finally addressed please so we can actually be able to use the integrations and the data available? (Especially since these are supposed to be official integrations, in the case of Airtable and Postgres.)

Thanks.

Makes sense!

@icaro I bumped into this commit and noticed the addition of enum and json types. Is this related to the issue described above and is it supposed to be a fix?

I just checked now and db fields of type json still show up as unknown in Plasmic.

Yes, that commit specifically just adds the types for the public package. The complete fix should be merged today or tomorrow!

Awesome, can’t wait :slightly_smiling_face:

Hey @exhaustive_panther. This should be working now

@icaro Thanks for working on this!

So I checked on this and there are improvements, but also some issues.

The good thing - After switching the field type back to JSON, Plasmic now detects it as JSON.

However, upon refreshing the data, I get a minified react error and oddly, no dynamic data in data picker (I was loading the results of the page query into a state variable).

Can you send me the project ID please?

The query does return the proper data though.

This can happen if you are rendering something that is not valid react element (like, say, if you’re directly rendering a json object). Are you somewhere directly rendering the value of tour state variable?

Maybe, checking now. Because I had to keep the field as a string before, I had to JSON.parse it in state variable which is then referenced in a bunch of places.

Ok, so if I remove the dynamic value of the state variable, the minified react error goes away. But as soon as I add it back, it reappears. I am simply trying to load the fields of an object from the query results:

Elements on the page try to render a field from the object that should be loaded into the state variable:

I am able to repro the error on a new page with no page elements that reference the state variable. As soon as I try to load the object from the query via the dynamic value, it gives the minified react error.

The state variable is configured as an Object as shown in previous screenshots.

It seems to happen with any query, so it’s not specific to the one query and content/results.

Oh sorry actually you’re right, that’s not the issue… We’ll dig into it

@icaro @chungwu So I checked this today again to see if the issue is still present and at first it looked like it was fixed. I wasn’t getting the minified error anymore and everything worked fine in Preview. Upon publishing, going through the same tests on published side gives an application error/black screen.

Maybe this requires more investigation?

Actually, this may be related to another issue Chung is looking into, so I will check again once that is resolved