ExamGecko
Question list
Search
Search

Question 519 - COF-C02 discussion

Report
Export

A Snowflake user is writing a User-Defined Function (UDF) that includes some unqualified object names.

How will those object names be resolved during execution?

A.
Snowflake will resolve them according to the SEARCH_PATH parameter.
Answers
A.
Snowflake will resolve them according to the SEARCH_PATH parameter.
B.
Snowflake will only check the schema the UDF belongs to.
Answers
B.
Snowflake will only check the schema the UDF belongs to.
C.
Snowflake will first check the current schema, and then the schema the previous query used
Answers
C.
Snowflake will first check the current schema, and then the schema the previous query used
D.
Snowflake will first check the current schema, and them the PUBLIC schema of the current database.
Answers
D.
Snowflake will first check the current schema, and them the PUBLIC schema of the current database.
Suggested answer: D

Explanation:

Object Name Resolution: When unqualified object names (e.g., table name without schema) are used in a UDF, Snowflake follows a specific hierarchy to resolve them. Here's the order:

Current Schema:Snowflake first checks if an object with the given name exists in the schema currently in use for the session.

PUBLIC Schema:If the object isn't found in the current schema, Snowflake looks in the PUBLIC schema of the current database.

Note: The SEARCH_PATH parameter influences object resolution for queries, not within UDFs.

References:

Snowflake Documentation (Object Naming Resolution):https://docs.snowflake.com/en/sql-reference/name-resolution.html

asked 23/09/2024
antonio de simone
36 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first