I am trying to load this big JSON file (sample can be seen below) into one of my tables in Snowflake. I tried creating an internal stage “TEST” with Snowsight and manually importing the file into the internal stage. I then ran the following command from my internal stage:
COPY INTO TEST
FROM (
SELECT $1
FROM @TEST
)
FILE_FORMAT = (TYPE = 'JSON');
The above loaded the file with no errors however when I run a SELECT * FROM TEST
to check the content of the table TEST I see the file has not been imported properly as probably it exceeds the 16MB of the variant data type column:
A sample of the file I am trying to upload can be seen below (the “results” keys in the original file is much bigger than the one seen below). Any ideas / suggestions how I should go about importing this file into a table in Snowflake?
{
"payload": {
"run_details": {
"run_id": "abc",
"run_date": "2024-06-26 03:56:58"
},
"connections": {
"source": {
"type": "oracle",
"host": "abc",
"database": "abc",
"table_name": "table1"
},
"target": {
"type": "snowflake",
"database": "abc",
"schema": "abc",
"table_name": "table2"
}
},
"Keys": [
"ACCOUNTING_ID",
"SEQ"
],
"Comparison_Columns": [
"ACCOUNTING_YEAR",
"ACCOUNTING_PERIOD",
"CURR_AMOUNT",
"ROWVERSION"
],
"results": [
{
"Sign": "-",
"keys": {
"ACCOUNTING_ID": "abc",
"SEQ": "1"
},
"columns": {
"ACCOUNTING_YEAR": null,
"ACCOUNTING_PERIOD": null,
"CURR_AMOUNT": "11111",
"ROWVERSION": "2024-06-24 22:41:11.000000"
}
},
{
"Sign": "+",
"keys": {
"ACCOUNTING_ID": "111111",
"SEQ": "1"
},
"columns": {
"ACCOUNTING_YEAR": null,
"ACCOUNTING_PERIOD": null,
"CURR_AMOUNT": "11111.000",
"ROWVERSION": "2024-06-25 22:41:16.000000"
}
},
{
"Sign": "-",
"keys": {
"ACCOUNTING_ID": "abc",
"SEQ": "2"
},
"columns": {
"ACCOUNTING_YEAR": null,
"ACCOUNTING_PERIOD": null,
"CURR_AMOUNT": "731.2600000",
"ROWVERSION": "2024-06-24 22:41:11.000000"
}
},
{
"Sign": "+",
"keys": {
"ACCOUNTING_ID": "1111111",
"SEQ": "2"
},
"columns": {
"ACCOUNTING_YEAR": null,
"ACCOUNTING_PERIOD": null,
"CURR_AMOUNT": "700000.00000",
"ROWVERSION": "2024-06-25 22:41:16.000000"
}
}
}