Resolve object names and parameter scope
Predict which object and setting a session uses after switching schemas, roles or defaults.
Resolve object names and parameter scope
Work through the decision
Two accounts each have an ANALYTICS database. A script uses SALES without a schema and overrides its time zone. How can an operator verify both target and effective configuration?
Check your reasoning
Identify the account, database and schema. Use a fully qualified name inside that account when the target must be explicit. Check session context functions and inspect the effective parameter at its applicable levels. A session variable created for the script is different from a parameter governing session behavior.
Compare the choices
- Qualified object name
- Specify database, schema and object when search context might vary, within the intended account.
- Session parameter override
- Set a supported session parameter to change behavior locally over an inherited default.
- Session variable
- Hold a reusable session-scoped value such as a filter date, commonly referenced with a dollar prefix in SQL.
- Context function
- Evaluate active execution context, such as CURRENT_DATABASE() or CURRENT_ROLE().
- Schema-level object
- Locate tables, views, file formats, stages, procedures and similar database objects in their containing schema.
Test the decision
A session inherits a user-level time zone and then sets its own value. A second session can still inherit the original default. A table, file format or procedure belongs to a schema, whereas roles and warehouses have account scope. Identify the object type before deciding how to name or grant it.
Practice the guide skills
- Draw organization, account, database, schema and object boundaries for one deployment. Watch 14:38
- Place a table, view, UDF, file format, stage, stored procedure, sequence, pipe and model in their proper scope. Watch 16:08
- Distinguish an account-level share from a schema’s objects and an installed application from its application package. Watch 17:55
- Compare supported account, user and session parameter values to identify the effective setting. Watch 20:47
- Set a session variable for one cutoff and describe when its value is lost. Watch 21:55
- Check CURRENT_DATABASE(), CURRENT_SCHEMA() and CURRENT_ROLE() before resolving an unqualified reference. Watch 22:19
Official objectives for this lesson
Related lesson · Configure a workspace for its workloads
Resolve object names and parameter scope quiz
Answer 3 questions. Check each answer for an explanation.