Module 10 · Lesson 7 of 8Detailed study · about 20 min

Caller rights, owner rights and execution access

Execution rights determine whose privileges a procedure uses. Invoking a routine and accessing its underlying objects are separate permission questions.

Understand the idea

Caller rights are explicit in these lessons so learners must have the permissions used by the workflow. Owner rights can delegate a narrow action without granting every underlying table privilege directly, but the procedure must expose only intended operations.

Key ideas in simple English
ConceptWhat it means
EXECUTE AS CALLERUses the caller’s privileges and context.
EXECUTE AS OWNERUses owner-rights behavior for delegated work.
USAGE privilegeAllows invocation, subject to required parent/object access.

A concrete example

Inspect the existing learning routines; visible output depends on your role.

Remember: Check invocation rights and execution mode separately from data access.

Explain it step by step · full theory

Understand the idea

Caller rights are explicit in these lessons so learners must have the permissions used by the workflow. Owner rights can delegate a narrow action without granting every underlying table privilege directly, but the procedure must expose only intended operations.

Owner rights are not permission to accept arbitrary SQL from an untrusted caller. Hard-code approved object boundaries or validate identifiers and bind values appropriately. Do not concatenate user input into executable SQL.

Follow the example

Routine grants include the argument signature because overloaded routines may share a name. A role also needs USAGE on the parent database/schema and suitable compute access. For caller-rights procedures it needs the underlying data privileges as well.

Words used in this lesson
EXECUTE AS CALLER
Uses the caller’s privileges and context.
EXECUTE AS OWNER
Uses owner-rights behavior for delegated work.
USAGE privilege
Allows invocation, subject to required parent/object access.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Caller rights, owner rights and execution access

Input
Business rule

Start with the requirement

Execution rights determine whose privileges a procedure uses. Invoking a routine and accessing its underlying objects are separate permission questions.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Start with the requirement

    Execution rights determine whose privileges a procedure uses. Invoking a routine and accessing its underlying objects are separate permission questions.

  2. Apply the rule

    Caller rights are explicit in these lessons so learners must have the permissions used by the workflow. Owner rights can delegate a narrow action without granting every underlying table privilege directly, but the procedure must expose only intended operations.

  3. Explain the result

    Check invocation rights and execution mode separately from data access.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual practice in an authorized Snowflake learning account. Run lesson 1 setup first and select L2_OBJECTS_LAB.M10_LAB and your authorized warehouse in each session. Use fresh object names; do not replace existing objects. Read whole scripting blocks before running them. The website does not execute commands.

Inspect routine definitions and grants

SQL · example
SHOW PROCEDURES IN SCHEMA L2_OBJECTS_LAB.M10_LAB;
SHOW USER FUNCTIONS IN SCHEMA L2_OBJECTS_LAB.M10_LAB;
SHOW GRANTS ON PROCEDURE L2_OBJECTS_LAB.M10_LAB.M10_HELLO();

What to expect and why

Inspect the existing learning routines; visible output depends on your role.

Administrator grant template

SQL · example
-- Replace the role placeholder; run only as an authorized grant owner.
GRANT USAGE ON DATABASE L2_OBJECTS_LAB TO ROLE <learner_role>;
GRANT USAGE ON SCHEMA L2_OBJECTS_LAB.M10_LAB TO ROLE <learner_role>;
GRANT USAGE ON FUNCTION L2_OBJECTS_LAB.M10_LAB.M10_NET(NUMBER,NUMBER) TO ROLE <learner_role>;
GRANT USAGE ON PROCEDURE L2_OBJECTS_LAB.M10_LAB.M10_HELLO() TO ROLE <learner_role>;

What to expect and why

These statements permit routine use; they do not automatically grant all table privileges or change cloud permissions.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Does procedure USAGE automatically grant all source-table privileges?

Try it yourself

Why include NUMBER,NUMBER in the function grant?

Compare your reasoning

The signature identifies the specific overload being granted.

Official sources and curriculum

Module 10 · See module scope