<< Prev Question Next Question >>

Question 27/75

Create a task and a stream following the below steps. So, when the
system$stream_has_data('rawstream1') condition returns false, what will happen to the task ?
-- Create a landing table to store raw JSON data.
-- Snowpipe could load data into this table. create or replace table raw (var variant);
-- Create a stream to capture inserts to the landing table.
-- A task will consume a set of columns from this stream. create or replace stream rawstream1 on table raw;
-- Create a second stream to capture inserts to the landing table.
-- A second task will consume another set of columns from this stream. create or replace stream rawstream2 on table raw;
-- Create a table that stores the names of office visitors identified in the raw data. create or replace table names (id int, first_name string, last_name string);
-- Create a table that stores the visitation dates of office visitors identified in the raw data.
create or replace table visits (id int, dt date);
-- Create a task that inserts new name records from the rawstream1 stream into the names table
-- every minute when the stream contains records.
-- Replace the 'etl_wh' warehouse with a warehouse that your role has USAGE privilege on. create or replace task raw_to_names
warehouse = etl_wh schedule = '1 minute' when
system$stream_has_data('rawstream1') as
merge into names n
using (select var:id id, var:fname fname, var:lname lname from rawstream1) r1 on n.id = to_number(r1.id)
when matched then update set n.first_name = r1.fname, n.last_name = r1.lname
when not matched then insert (id, first_name, last_name) values (r1.id, r1.fname, r1.lname)
;
-- Create another task that merges visitation records from the rawstream1 stream into the visits table
-- every minute when the stream contains records.
-- Records with new IDs are inserted into the visits table;
-- Records with IDs that exist in the visits table update the DT column in the table.
-- Replace the 'etl_wh' warehouse with a warehouse that your role has USAGE privilege on. create or replace task raw_to_visits
warehouse = etl_wh schedule = '1 minute' when
system$stream_has_data('rawstream2') as
merge into visits v
using (select var:id id, var:visit_dt visit_dt from rawstream2) r2 on v.id = to_number(r2.id) when matched then update set v.dt = r2.visit_dt
when not matched then insert (id, dt) values (r2.id, r2.visit_dt)
;
-- Resume both tasks.
alter task raw_to_names resume;
alter task raw_to_visits resume;
-- Insert a set of records into the landing table. insert into raw
select parse_json(column1) from values
('{"id": "123","fname": "Jane","lname": "Smith","visit_dt": "2019-09-17"}'),
('{"id": "456","fname": "Peter","lname": "Williams","visit_dt": "2019-09-17"}');
-- Query the change data capture record in the table streams select * from rawstream1;
select * from rawstream2;

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

Question List (75q)
Question 1: A company's client application supports multiple authenticat...
Question 2: Data sharing is supported only between provider and consumer...
Question 3: You ran a query and the query SELECT * FROM inventory WHERE ...
Question 4: What is a valid object hierarchy when building a Snowflake e...
1 commentQuestion 5: How is the change of local time due to daylight savings time...
Question 6: An Architect has been asked to clone schema STAGING as it lo...
Question 7: A company has a Snowflake account named ACCOUNTA in AWS us-e...
Question 8: What will happen if you try to ALTER a COLUMN(which has NULL...
Question 9: Which of the two are limitations of the insertReport API of ...
Question 10: One of your colleagues has submitted a long running query in...
Question 11: Files stored in snowflake internal stage are automatically e...
Question 12: Which of the below commands lists all the pipes for which yo...
Question 13: In the default access control hierarchy, both securityadmin ...
Question 14: Which command below will load data from result_scan to a tab...
Question 15: You have created a table as below CREATE TABLE SNOWFLAKE (FL...
Question 16: You have a need to make external file data available to your...
Question 17: There are two databases in an account, named fin_db and hr_d...
Question 18: Which privilege grants ability to set a Column-level Securit...
1 commentQuestion 19: As of today snowflake supports replication for databases onl...
Question 20: You have a very large table which is already clustered on co...
Question 21: If your role does not own the share, but owns the objects in...
Question 22: Snowflake has row level security...
Question 23: Materialized views based on external tables can improve quer...
Question 24: Which of the below objects cannot be replicated?...
Question 25: When loading data from stage using COPY INTO, what options c...
Question 26: A healthcare company is deploying a Snowflake account that m...
Question 27: Create a task and a stream following the below steps. So, wh...
1 commentQuestion 28: When loading data into a table that captures the load time i...
Question 29: An Architect has chosen to separate their Snowflake Producti...
Question 30: Select the true statement
Question 31: Snowflake supports the following query performance optimizin...
Question 32: An Architect would like to save quarter-end financial result...
Question 33: With default settings for multi cluster warehouse, how does ...
Question 34: Shares are first-class objects in Snowflake for which Snowfl...
Question 35: Data replication in snowflake helps in...
Question 36: You have a table named JSON_TBL which has a variant column J...
Question 37: How do you validate the data that is unloaded using COPY INT...
Question 38: Below are the rest APIs provided by Snowpipe...
Question 39: Which command will you run to list all privileges and roles ...
Question 40: One of your joins is taking a lot of time. The query profile...
Question 41: COMPRESSION = AUTO can automatically detect below compressio...
Question 42: When would you usually consider to add clustering key to a t...
Question 43: To convert JSON null value to SQL null value, you will use...
Question 44: select metadata$filename, metadata$file_row_number from @fil...
Question 45: You have written a procedure and a function in snowflake. Ho...
Question 46: Which organization-related tasks can be performed by the ORG...
Question 47: Which command below will only copy the table structure from ...
Question 48: Select the true statements about TASKS...
Question 49: For which use cases, will you use cross-cloud and cross-regi...
Question 50: If a multi-cluster warehouse is resized, the new size applie...
Question 51: A Snowflake Architect is designing a multi-tenant applicatio...
Question 52: You have a table named customer_table. You want to create an...
Question 53: It is recommended to assign ACCOUNTADMIN role to atleast two...
Question 54: Every Snowflake table loaded by the Kafka connector has a sc...
Question 55: Files arrive in an external stage every 10 seconds from a pr...
Question 56: Which semi structured data function interprets an input stri...
Question 57: Bytes spilled to remote storage in query profile indicates v...
Question 58: You have a medium warehouse with auto suspend of 5 minutes. ...
Question 59: For authentication, snowflake Kafka connector relies on:...
Question 60: Out of the three query optimization techniques(search optimi...
Question 61: While creating a clustering key, what is the recommendation ...
Question 62: Which command can be run to list all shares that have been c...
Question 63: When a database gets cloned, what accesses are replicated...
Question 64: Arrange in order of performance(least to high) 1. External T...
Question 65: Who can view account-level Credit and Storage Usage?...
Question 66: You have created a table as below CREATE TABLE EMPLOYEE(EMPL...
Question 67: You have created a TASK in snowflake. How will you resume it...
Question 68: Please select the correct hierarchy from below (Exhibit)...
Question 69: What are some of the characteristics of result set caches? (...
Question 70: Which alter command below may affect the availability of col...
Question 71: For this object, Snowflake executes code outside Snowflake; ...
Question 72: A stream stores data with the same columns as the source dat...
Question 73: Which security, governance, and data protection features req...
Question 74: Schema owner can grant object privileges in a regular schema...
Question 75: How does a standard virtual warehouse policy work in Snowfla...