Data Transformations
Perform data transformations using SQL and Snowflake features for data modeling and processing (18% of exam).
Data Transformations in Snowflake refer to the process of modifying, converting, or manipulating data as it moves through various stages of your data pipeline. Understanding data transformations is essential for the SnowPro Core Certification. Snowflake supports transformations during data loading…
Concepts covered: DDL operations (CREATE, ALTER, DROP), DML operations (INSERT, UPDATE, DELETE, MERGE), Query syntax and clauses, CTEs and subqueries, Window functions, VARIANT data type, Querying semi-structured data, FLATTEN function for nested data, LATERAL joins, PARSE_JSON and JSON functions, User-defined functions (UDFs), Stored procedures, JavaScript and SQL UDFs, External functions, Streams for change data capture, Tasks for scheduling, Task dependencies and DAGs, Sequences for auto-incrementing
COF-C02 - Data Transformations Example Questions
Test your knowledge of Data Transformations
Question 1
A hospitality management company operates a chain of hotels and stores guest reservation data in Snowflake. Their 'reservations' table includes a VARIANT column 'booking_details' containing JSON structures. Each booking has a 'room_allocations' array where each allocation object contains 'room_number', 'check_in_date', 'check_out_date', and 'guest_preferences' (an object with 'bed_type', 'floor_level', and 'special_requests' which is an array of strings like 'extra pillows', 'late checkout'). The guest services team wants to identify the most frequently requested special amenities across all reservations to improve inventory planning. They need to count occurrences of each unique special request string. When the team applies FLATTEN to the 'room_allocations' array, they can access room details and the guest_preferences object, but the 'special_requests' array within each allocation still appears as a single VARIANT value rather than individual string elements. The report requires one row per special request item while tracking which room allocation it belongs to. How should the team construct their query to properly extract each individual special request string from the nested structure?
Question 2
A telecommunications provider has built a Snowflake task DAG for processing call detail records (CDRs). The DAG structure is: TASK_CDR_INGEST (root scheduled at midnight) → TASK_NORMALIZE → TASK_RATING, with TASK_RATING branching into TASK_PREPAID_BILLING and TASK_POSTPAID_BILLING running in parallel, both converging into TASK_REVENUE_REPORT. During a performance review, the operations team wants to monitor the execution status of the entire DAG run programmatically. They need to query which runs have completed, which are still in progress, and identify any failures across all tasks in the hierarchy. The team is evaluating different approaches to obtain this visibility. Which method provides the most comprehensive view of task execution history and status across the entire DAG?
Question 3
Which clause in a Snowflake stored procedure definition determines whether the procedure executes using the privileges of the procedure owner or the calling user?