Step 2. Create Stage Objects¶
A stage specifies where data files are stored (i.e. “staged”) so that the data in the files can be loaded into a table. A named external stage is a cloud storage location managed by Snowflake. An external stage references data files stored in a S3 bucket. In this case, we are creating a stage that references the sample data files necessary to complete the tutorial.
Creating a named external stage is useful if you want multiple users or processes to upload files. If you plan to stage data files to load only by you, or to load only into a single table, then you may prefer to use your user stage or the table stage. For information, see Bulk Loading from Amazon S3.
In this step, you create named stages for the different types of sample data files.
Creating a Stage for CSV Data Files¶
Execute CREATE STAGE to create the my_csv_stage
stage:
CREATE OR REPLACE STAGE my_csv_stage
FILE_FORMAT = mycsvformat
URL = 's3://snowflake-docs';
Creating a Stage for JSON Data Files¶
Execute CREATE STAGE to create the my_json_stage
stage:
CREATE OR REPLACE STAGE my_json_stage
FILE_FORMAT = myjsonformat
URL = 's3://snowflake-docs';
Note
In regular use, if you were creating a stage that pointed to your private data files, you would reference a storage integration created using CREATE STORAGE INTEGRATION by an account administrator (i.e. a user with the ACCOUNTADMIN role) or a role with the global CREATE INTEGRATION privilege:
CREATE OR REPLACE STAGE external_stage FILE_FORMAT = mycsvformat URL = 's3://private-bucket' STORAGE_INTEGRATION = myint;