Large JSON File Data Loader
Load large JSON files with a DataPancake chunking UDTF.
1. Upload your JSON file to a stage in Snowflake
2. Open a new Snowflake worksheet
3. Execute the following statement to create a new table
Replace the database, schema, and table name placeholders.
CREATE OR REPLACE TABLE <database_name>.<schema_name>.<table_name>(
file_path STRING NOT NULL, -- path in stage where JSON was read
file_hash VARCHAR(64) NOT NULL, -- SHA-256 hex digest of the full file
chunk_index INTEGER NOT NULL, -- zero-based index of this chunk
chunk_count INTEGER NOT NULL, -- total number of chunks for this file
chunk_json VARIANT NOT NULL, -- parsed JSON fragment
primary_key STRING , -- primary key
processed_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP() -- load time
)
COMMENT = 'Stores JSON chunks emitted by DataPancake UDTF: FN_CHUNK_JSON_FROM_STAGED_FILE_UDTF';4. Execute the following statement to process the XML file
Replace the database, schema, table, stage, filename, header element name, chunk element name, and max_chunk_size_in_mb placeholders.
5. Verify the statements executed successfully
Last updated
Was this helpful?