Bird
Raised Fist0
Snowflakecloud~20 mins

Loading from S3, Azure Blob, GCS in Snowflake - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Cloud Storage Loading Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Understanding Snowflake External Stage Behavior with S3

You create an external stage in Snowflake pointing to an S3 bucket with the following command:

CREATE STAGE mystage URL='s3://mybucket/data/' CREDENTIALS=(AWS_KEY_ID='AKIA...' AWS_SECRET_KEY='SECRET...');

You then run:

LIST @mystage;

What will this command output?

AA list of all files and folders under s3://mybucket/data/ including their sizes and timestamps.
BAn error because credentials are missing.
CAn empty list because Snowflake cannot list files in S3 buckets.
DOnly files with .csv extension will be listed.
Attempts:
2 left
💡 Hint

Think about what the LIST command does on an external stage.

Architecture
intermediate
2:00remaining
Choosing Cloud Storage for Snowflake Data Loading

Your company uses Snowflake and wants to load large datasets from cloud storage. You have options: AWS S3, Azure Blob Storage, and Google Cloud Storage (GCS). Which factor is most important when choosing the cloud storage service for loading data into Snowflake?

AThe geographic region of the storage service matching Snowflake's region to reduce latency.
BThe cheapest storage cost regardless of location or compatibility.
CThe number of files stored in the bucket.
DThe color of the cloud provider's logo.
Attempts:
2 left
💡 Hint

Think about what affects data transfer speed and cost when loading data.

security
advanced
2:00remaining
Securing Snowflake External Stage Access to Azure Blob Storage

You want to create an external stage in Snowflake to load data from Azure Blob Storage securely. Which method provides the best security practice for authentication?

AEmbed the Azure storage account key directly in the stage definition without restrictions.
BUse a Shared Access Signature (SAS) token with limited permissions and expiration time.
CUse anonymous public access to the blob container.
DStore the storage account key in a plain text file on your local machine.
Attempts:
2 left
💡 Hint

Consider the principle of least privilege and temporary credentials.

Configuration
advanced
2:00remaining
Configuring Snowflake Stage for Google Cloud Storage with IAM Role

You want to create an external stage in Snowflake to load data from Google Cloud Storage (GCS) using an IAM role for authentication. Which configuration is correct?

ACREATE STAGE mystage URL='gcs://mybucket/data/' CREDENTIALS=(AZURE_SAS_TOKEN='token');
BCREATE STAGE mystage URL='gcs://mybucket/data/' CREDENTIALS=(GCS_KEYFILE='path/to/key.json');
CCREATE STAGE mystage URL='gcs://mybucket/data/' CREDENTIALS=(AWS_KEY_ID='id' AWS_SECRET_KEY='key');
DCREATE STAGE mystage URL='gcs://mybucket/data/' STORAGE_INTEGRATION = my_gcs_integration;
Attempts:
2 left
💡 Hint

Think about how Snowflake integrates with GCS using IAM roles.

🧠 Conceptual
expert
2:00remaining
Behavior of Snowflake COPY INTO with Multiple Cloud Storage Sources

You have three external stages in Snowflake pointing to S3, Azure Blob, and GCS respectively. You want to load data from all three into a single Snowflake table using the COPY INTO command. Which statement is true about this operation?

ACOPY INTO automatically detects and merges data from all cloud providers if stages have the same name.
BCOPY INTO can load from multiple external stages simultaneously by listing all stage URLs in one command.
CYou must run separate COPY INTO commands for each external stage; COPY INTO cannot load from multiple stages at once.
DCOPY INTO only supports loading from one cloud provider per Snowflake account.
Attempts:
2 left
💡 Hint

Consider how COPY INTO references external stages.

Practice

(1/5)
1. What is the main purpose of using COPY INTO in Snowflake when loading data from S3, Azure Blob, or GCS?
easy
A. To load data files from cloud storage into Snowflake tables
B. To export data from Snowflake to cloud storage
C. To create a new cloud storage bucket
D. To delete files from cloud storage

Solution

  1. Step 1: Understand the role of COPY INTO

    The COPY INTO command is used in Snowflake to load data from external cloud storage into Snowflake tables.
  2. Step 2: Differentiate from other operations

    Exporting data, creating buckets, or deleting files are not done by COPY INTO. It specifically loads data into tables.
  3. Final Answer:

    To load data files from cloud storage into Snowflake tables -> Option A
  4. Quick Check:

    Loading data = COPY INTO [OK]
Hint: COPY INTO loads data from cloud storage to tables [OK]
Common Mistakes:
  • Confusing COPY INTO with export commands
  • Thinking COPY INTO manages cloud storage buckets
  • Assuming COPY INTO deletes files
2. Which of the following is the correct syntax to load data from an S3 bucket into a Snowflake table named my_table?
easy
A. COPY INTO my_table FROM @my_s3_stage FILE_FORMAT = (TYPE = 'CSV');
B. LOAD DATA INTO my_table FROM 's3://mybucket/data.csv';
C. INSERT INTO my_table SELECT * FROM s3://mybucket/data.csv;
D. IMPORT INTO my_table FROM @my_s3_stage FORMAT = CSV;

Solution

  1. Step 1: Identify correct Snowflake COPY INTO syntax

    Snowflake uses COPY INTO table_name FROM @stage FILE_FORMAT = (TYPE = 'format') to load data.
  2. Step 2: Eliminate incorrect options

    LOAD DATA INTO is not valid Snowflake syntax. Direct INSERT INTO ... FROM s3:// paths are not supported. IMPORT INTO does not exist. The correct syntax is COPY INTO my_table FROM @my_s3_stage FILE_FORMAT = (TYPE = 'CSV');.
  3. Final Answer:

    COPY INTO my_table FROM @my_s3_stage FILE_FORMAT = (TYPE = 'CSV'); -> Option A
  4. Quick Check:

    COPY INTO + stage + file format = correct syntax [OK]
Hint: COPY INTO + @stage + FILE_FORMAT is the right pattern [OK]
Common Mistakes:
  • Using LOAD DATA instead of COPY INTO
  • Trying to SELECT directly from S3 path
  • Using IMPORT INTO which is invalid
3. Given the following Snowflake command:
COPY INTO sales FROM @azure_blob_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'CONTINUE';

What happens if one file in the Azure Blob storage has invalid JSON data?
medium
A. The entire load fails and no data is loaded
B. Snowflake automatically fixes the invalid JSON and loads all data
C. Only the invalid file is skipped, and loading continues for others
D. The command ignores the error and loads all files including invalid data

Solution

  1. Step 1: Understand ON_ERROR = 'CONTINUE'

    This option tells Snowflake to skip files or rows with errors and continue loading the rest.
  2. Step 2: Apply to invalid JSON file

    The invalid JSON file will be skipped, but other valid files will load successfully.
  3. Final Answer:

    Only the invalid file is skipped, and loading continues for others -> Option C
  4. Quick Check:

    ON_ERROR = CONTINUE skips errors, loads rest [OK]
Hint: ON_ERROR = CONTINUE skips bad files, loads others [OK]
Common Mistakes:
  • Assuming entire load fails on one bad file
  • Thinking Snowflake auto-fixes JSON errors
  • Believing invalid data is loaded anyway
4. You run this command to load data from Google Cloud Storage:
COPY INTO customers FROM @gcs_stage FILE_FORMAT = (TYPE = 'CSV');

But you get an error saying 'Storage integration not authorized'. What is the most likely cause?
medium
A. The GCS bucket is empty
B. The CSV file format is incorrect
C. The Snowflake table does not exist
D. The storage integration lacks permission to access the GCS bucket

Solution

  1. Step 1: Analyze the error message

    'Storage integration not authorized' means Snowflake cannot access the cloud storage due to permission issues.
  2. Step 2: Identify cause

    The storage integration must have proper permissions to read from the GCS bucket. Other options do not cause authorization errors.
  3. Final Answer:

    The storage integration lacks permission to access the GCS bucket -> Option D
  4. Quick Check:

    Authorization error = permission issue [OK]
Hint: Authorization errors usually mean permission problems [OK]
Common Mistakes:
  • Blaming file format for authorization errors
  • Assuming table existence causes storage errors
  • Ignoring permission setup for storage integration
5. You want to load multiple CSV files from an S3 bucket into Snowflake, but only files with the prefix 2024/. Which COPY INTO command correctly filters these files?
hard
A. COPY INTO sales FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') WHERE filename LIKE '2024/%';
B. COPY INTO sales FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') PATTERN = '^2024/.*';
C. COPY INTO sales FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') FILES = ('2024/');
D. COPY INTO sales FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') PATTERN = '2024/.*';

Solution

  1. Step 1: Understand file filtering in COPY INTO

    Snowflake uses the PATTERN parameter with a regular expression to filter files by name or prefix.
  2. Step 2: Check regex correctness

    PATTERN = '^2024/.*' matches files starting exactly with '2024/'. PATTERN = '2024/.*' without the ^ may match files where '2024/' appears elsewhere in the path. The other options use invalid parameters like WHERE or FILES.
  3. Final Answer:

    COPY INTO sales FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') PATTERN = '^2024/.*'; -> Option B
  4. Quick Check:

    PATTERN with ^ prefix filters files correctly [OK]
Hint: Use PATTERN with ^ prefix to filter file names [OK]
Common Mistakes:
  • Omitting ^ in regex causing wrong files to load
  • Using WHERE or FILES incorrectly for filtering
  • Confusing file prefix with file list