09-02-2021 08:09 PM
How can I load JSONB data using Postgres snaps? I’m able to load the data as TEXT type but not as JSONB type.
Below is how I’m setting up my pipeline for inserting data to postgres db:
Any answers would be appreciated!
Solved! Go to Solution.
09-07-2021 08:11 PM
Never mind, was able to resolve by casting to jsonb using the execute snap. Thanks!
09-03-2021 01:40 AM
Hi @anayak
If you are able to load it as TEXT easiest fix would be in the mapper to use JSON.stringify(value) function. This function will convert your value into JSON string.
Also you can try to insert your records with “PostgreSQL - Bulk Load” or with “PostgreSQL - Execute” snaps.
Regards,
Pero Manchevski
09-06-2021 10:02 PM
I have tried JSON.stringify and Json.parse, the value is converted to JSON but not read as jsonb when run with Postgres-Insert snap. Will try bulk load and execute snaps instead. Thanks!
09-07-2021 01:57 PM
@pmanchevski When I use Bulk Load, the auto-increment process_id column can’t be left empty but it does allow loading jsonb data. If I use Insert snap, then JSON.stringify() does make a json string but Inser Snap reads it implicitly as varchar/text and I have no way to typecast in the Insert Snap.
Also, as the data is coming from an excel file where $(all of the excel file data) is used in a column in the table, I’m not sure how to load the data as JSONB using the execute or insert snap.
Here’s the mapper fields:
followed by Insert:
09-07-2021 08:11 PM
Never mind, was able to resolve by casting to jsonb using the execute snap. Thanks!