Search code examples
snowflake-cloud-data-platformsnowflake-schemasnowflake-connector

Create a stage to be used across all schemas


I have created a stage in a schema called X, when I run the command "show stages" I am able to see that stage. Now when I go to the other schema "Y" and run the command "show stages", it is not showing that schema. I want to use the stage in "X". How can I do this?

Thanks, Xi


Solution

  • To use a stage from different schema that currently in use, namespace has to be provided:

    COPY INTO ...
    FROM @[namespace.]ext_stage_name[/path]
    

    COPY INTO

    FROM ...

    namespace is the database and/or schema in which the internal or external stage resides, in the form of database_name.schema_name or schema_name. It is optional if a database and schema are currently in use within the user session; otherwise, it is required.


    The same applies for ad-hoc querying data from stages:

    SELECT ...
    FROM @[namespace.]external_stage_name[/path]