In Snowflake, a stage is an area where data files are prepared (”staged”) before importing them. Stages can be internal (stored and managed within Snowflake) or external (in an S3 bucket, Google Cloud Storage, etc).
We will be configuring a stage called beat_stage
, that maps to the data export directory in Backblaze through the S3 compatible API Backblaze exposes.
You cannot use Snowflake’s UI to create the stage, as it isn’t built to create external stages in Backblaze. So, you need to use the following SQL statement, taking care to replace <tenant>
, <b2_key_id>
and <b2_secret>
with the values provided to you.
<aside> <img src="/icons/warning_orange.svg" alt="/icons/warning_orange.svg" width="40px" />
We strongly recommend that you keep the name of this stage as beat_stage
, as many of instructions in our guide reference it.
</aside>
CREATE STAGE IF NOT EXISTS beat_stage
URL = 's3compat://beatreports/<tenant>/'
ENDPOINT = '[s3.eu-central-003.backblazeb2.com](<https://s3.eu-central-003.backblazeb2.com/>)'
REGION = 'eu-central-003'
CREDENTIALS = (
AWS_KEY_ID = '<b2_key_id>'
AWS_SECRET_KEY = '<b2_secret>'
)
DIRECTORY = (
ENABLE = TRUE -- allow Snowflake to list the contents
);
Once this stage has been created, it will show up in Snowflake’s Databases view, and you should be able to browse the files inside it.