0
0
Snowflakecloud~20 mins

Semi-structured data querying (JSON, Avro) in Snowflake - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Semi-structured Data Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Extracting nested JSON values in Snowflake
Given a Snowflake table events with a VARIANT column data storing JSON objects, what is the output of this query?
SELECT data:user:name AS user_name FROM events WHERE data:user:age > 30;
AA list of ages where the user's name is greater than 30
BSyntax error due to incorrect JSON path syntax
CA list of user names where the user's age is greater than 30
DEmpty result because VARIANT columns cannot be filtered
Attempts:
2 left
💡 Hint
Remember that Snowflake uses colon notation to access nested JSON keys inside VARIANT columns.
Configuration
intermediate
2:00remaining
Loading Avro data into Snowflake
Which Snowflake COPY INTO command correctly loads Avro files from an S3 bucket into a table named avro_table with a VARIANT column data?
ACOPY INTO avro_table(data) FROM @my_s3_stage FILE_FORMAT = (TYPE = 'AVRO');
BCOPY INTO avro_table(data) FROM @my_s3_stage FILE_FORMAT = (TYPE = 'PARQUET');
CCOPY INTO avro_table(data) FROM @my_s3_stage FILE_FORMAT = (TYPE = 'CSV');
DCOPY INTO avro_table FROM @my_s3_stage FILE_FORMAT = (TYPE = 'JSON');
Attempts:
2 left
💡 Hint
Avro files require specifying FILE_FORMAT type as 'AVRO' in Snowflake.
Architecture
advanced
2:00remaining
Optimizing queries on semi-structured data in Snowflake
You have a large Snowflake table with a VARIANT column storing JSON data. Which approach best improves query performance when filtering on nested JSON fields?
AUse a materialized view that extracts and stores the nested JSON fields as separate columns
BStore the JSON as plain text and parse it at query time
CCreate a clustered index on the VARIANT column
DDisable automatic clustering on the table
Attempts:
2 left
💡 Hint
Materialized views can precompute and store extracted data for faster access.
security
advanced
2:00remaining
Securing access to semi-structured data in Snowflake
Which Snowflake feature allows restricting access to specific keys inside a VARIANT column storing JSON data?
ANetwork policies restricting IP addresses
BRow Access Policies with JSON path filtering
CColumn-level access control on the VARIANT column
DMasking Policies applied to the VARIANT column
Attempts:
2 left
💡 Hint
Masking policies can dynamically hide parts of data based on conditions.
🧠 Conceptual
expert
2:00remaining
Understanding Snowflake's handling of nested JSON arrays
Given a VARIANT column data containing JSON arrays of objects, which Snowflake SQL function correctly flattens the array for querying individual elements?
AEXPLODE(data)
BLATERAL FLATTEN(input => data)
CARRAY_EXPLODE(data)
DUNNEST(data)
Attempts:
2 left
💡 Hint
Snowflake uses a specific function to flatten VARIANT arrays in lateral joins.