SOL-C01 · Question #303
SOL-C01 Question #303: Real Exam Question with Answer & Explanation
The correct answer is E: Create a stored procedure that encapsulates all SQL statements and then call the stored. Snowflake Notebooks' cell does not directly support BEGIN...END transaction block. While the 'snowflake.connector' can manage transactions, it typically requires multiple cells for BEGIN, statements, and COMMIT/ROLLBACK. TRY/CATCH is not a valid SQL construct for transaction mana
Question
You are working with a Snowflake Notebook and need to execute a series of SQL statements that include both DDL (Data Definition Language) and DML (Data Manipulation Language) operations. You want to ensure that if any statement fails, the entire sequence is rolled back. How can you achieve this within a single Notebook cell?
Options
- AWrap the SQL statements within a 'BEGIN' and 'END' block within the cell. Snowflake Notebooks
- BUse the 'snowflake.connector' Python library to explicitly manage transactions using , followed by
- CPrefix each SQL statement with 'TRY and include a 'CATCH' block at the end to handle any
- DSnowflake Notebooks do not support transactions within a single cell. Each SQL statement is
- ECreate a stored procedure that encapsulates all SQL statements and then call the stored
Explanation
Snowflake Notebooks' cell does not directly support BEGIN...END transaction block. While the 'snowflake.connector' can manage transactions, it typically requires multiple cells for BEGIN, statements, and COMMIT/ROLLBACK. TRY/CATCH is not a valid SQL construct for transaction management. Option D is incorrect because transactions are possible using stored procedures called from a cell. The most reliable method is to create a stored procedure (E) that handles transaction management and call it from the notebook cell. This encapsulates the logic and ensures proper rollback behavior.
Topics
Community Discussion
No community discussion yet for this question.