Muhammad Salman
Muhammad Salman

Reputation: 1

Snowflake JSON import into Stage with double quote in column value

I've set stage file format as JSON and trying to import below data from Azure blob, getting error. see 2nd line last SQLTableName value has double quote.

{"SQLDatabaseName":"TV","SQLSchemaName":"sec","SQLTableName":"UserProfile"} {"SQLDatabaseName":"LW","SQLSchemaName":"sec","SQLTableName":"User"Profile"}

in sql server i am exporting each row in json above format to move data into snowflake.

Upvotes: 0

Views: 369

Answers (1)

Michael Golos
Michael Golos

Reputation: 2049

Your data in JSON format is incorrect, the second line is not JSON validated. Check your sample data on this page: JSON Formatter & Validator

You should use some escape character when exporting.

It does not validate:

SELECT PARSE_JSON('{"SQLDatabaseName":"LW","SQLSchemaName":"sec","SQLTableName":"User"Profile"}');

If you change your data and add an escape character, it will validate:

SELECT PARSE_JSON('{"SQLDatabaseName":"LW","SQLSchemaName":"sec","SQLTableName":"User\'Profile"}');

SELECT PARSE_JSON('{"SQLDatabaseName":"LW","SQLSchemaName":"sec","SQLTableName":"User\\"Profile"}');

Upvotes: 2

Related Questions