CertSafari
    Snowflake SnowPro Advanced: Data Analyst (DAA-C01)· Lessons

    Domain 1 · Lesson 6/19

    Loading data into Snowflake: stages, COPY INTO, external tables and DML

    Given a scenario, prepare data and load into Snowflake.

    23 min read
    2.43% of exam
    9 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Load CSV, JSON and Parquet files with the Snowsight wizard and know when its file limits force a PUT and COPY INTO path instead
    • Choose between user, table, named internal and external stages, and load from them with COPY INTO using FILES, PATTERN and a file format
    • Explain how load metadata stops files from being reloaded, and when FORCE or LOAD_UNCERTAIN_FILES overrides it
    • Diagnose rejected rows with COPY_HISTORY, VALIDATION_MODE, VALIDATE and ON_ERROR, and fix column-count mismatches in the file format
    • Create a partitioned external table, keep its metadata refreshed and weigh its performance against loading the data
    • Change loaded tables with INSERT, UPDATE with a join, and DML error logging

    Key concept

    Stage — A stage is the storage location that holds data files before they are loaded. It can be inside Snowflake (internal) or in your own cloud storage (external). Snowsight uploads, PUT, COPY INTO and external tables all read from or write to a stage.

    1.Loading files through Snowsight

    Snowsight is the quickest way to load a file, and it is built for small loads. It accepts structured files such as CSV and TSV, and semi-structured files in JSON, Avro, ORC, Parquet or XML. Files can come from your computer or from an existing stage. You can upload up to 250 files at a time, and each file can be up to 250 MB. The limit applies to the upload itself, so warehouse size makes no difference to it. For a file larger than 250 MB, or for thousands of files, use a client such as Snowflake CLI to stage the files, then load them with SQL.

    The wizard has two entry points, one for each kind of target. Create » Table » From File creates a new table. Snowsight runs INFER_SCHEMA on the file and shows the inferred file format, column names and data types for you to correct before you select Load. Ingestion » Add Data » Load data into a Table loads into a table that already exists. Two cases cannot use the create path: you cannot create a new table from an XML file, and you cannot create a new Apache Iceberg™ table. In both cases, create an empty table first and then load into it as an existing table. The privileges differ too. Creating a table needs CREATE TABLE on the schema. Loading into an existing table needs INSERT on the table, plus USAGE on the stage if the files come from one.

    Settings on the wizard's Edit Schema page and what each does
    SettingEffect
    File formatPick a named file format from the current database, or set the file type options yourself
    Error handlingChoose what happens when a row fails. By default, no data is loaded from the file
    AppendNew rows are added to the existing table (the default)
    ReplaceNew data replaces the existing data in the table
    Match by column namesMatches source columns to target columns by name. Case insensitive by default
    Load as a single variant column?For Parquet, clear this option to load the fields into separate columns

    Every wizard session runs in an explicit transaction, and Snowsight commits it whatever AUTOCOMMIT is set to for the account or user. If the selected warehouse is suspended when you finish, the load waits up to five minutes for it to resume.

    Checkpoint 1 of 10· Check yourself

    An analyst wants to load a 600 MB CSV file from their laptop into an existing table using the Snowsight Load Data wizard. What should they do?

    Sources1

    2.Stages: where files wait before loading

    SQL loading starts by putting the files in a stage, and your choice of stage decides who can use the files. An external stage points to cloud storage that your own organisation manages, in Amazon S3, Google Cloud Storage or Microsoft Azure. The stage object stores the URL, the access settings and, optionally, the file format. Snowflake can load from any of these three providers whichever cloud hosts your account. It cannot read archival storage classes such as S3 Glacier Deep Archive, which need a restore before the data can be read. Internal stages keep the files inside Snowflake, and there are three kinds.

    Internal stage types compared
    Stage typeWho manages the filesTables it can loadAccess control
    User stageA single userMultiple tablesCreated for each user automatically. Cannot be altered or dropped
    Table stageOne or more usersOnly its own tableNot a separate database object and has no privileges of its own. You need OWNERSHIP of the table
    Named internal stageOne or more usersOne or more tablesA database object in a schema, controlled with privileges. Created with CREATE STAGE

    In COPY syntax a named stage is @stage_name, a table stage is @%table_name and the user stage is @~. Each can take a path after it. PUT uploads a file from your local file system to any of the three internal stage types. This is the way past the Snowsight size limit. Run PUT from a client on the machine that holds the 1.2 GB export, sending it to a named internal stage, then run COPY INTO from that stage. External stages are filled with the cloud provider's own upload tools instead.

    Unstructured files such as PDFs and images also go to a stage, either with PUT or through a Snowsight upload, but they are never copied into table rows. A stage with a directory table catalogues them, and you refresh the directory table so that new files appear. Unstructured files via directory tables and file URLs covers how you then query them.

    Checkpoint 2 of 10· Match them up

    Match each stage type to the description that fits it

    Tap a term, then the definition that fits it.

    Sources23

    3.Loading staged files with COPY INTO

    COPY INTO <table> loads staged files into a table that already exists. It reads from a named internal stage, a table or user stage, a named external stage, or an external URL. Bulk loads run on the warehouse you specify, so size that warehouse for the volume of data. You choose files in one of two ways: FILES lists them by name, and PATTERN selects every file whose path matches a regular expression. The file format can be set in the statement or attached to the stage. Attaching it to the stage means every load from that stage parses files the same way (File format objects and options covers the options themselves).

    COPY INTO syntax for a standard loadsql
    /* Standard data load */
    COPY INTO [<namespace>.]<table_name>
         FROM { internalStage | externalStage | externalLocation }
    [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
    [ PATTERN = '<regex_pattern>' ]
    [ FILE_FORMAT = ( { FORMAT_NAME = '[<namespace>.]<file_format_name>' |
                        TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]
    [ copyOptions ]
    [ VALIDATION_MODE = RETURN_<n>_ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS ]

    A file does not have to match the table's layout column for column. If you replace the FROM @stage with FROM (SELECT $1, $3 ... FROM @stage), the COPY can reorder columns, leave columns out, cast values, and truncate text that is too long for the target column. Before you write that SELECT, query the staged file to check its shape, as shown in Querying staged files directly ($1, METADATA$FILENAME).

    Load metadata is what makes repeating a COPY safe. Snowflake records which files it has loaded into each table, and a later COPY skips those files, so running the same statement twice does not double the rows. Rows you delete afterwards do not change that record. If you empty the table and run the COPY again, the result is 0 files processed. To load the files again on purpose, add FORCE = TRUE. FORCE ignores load metadata and can duplicate data, so use it only after you have emptied the table or when duplicates do not matter.

    Load metadata expires after 64 days. If a file's LAST_MODIFIED date and its load are both more than 64 days old, the COPY cannot tell whether the file was loaded, so it skips the file by default. LOAD_UNCERTAIN_FILES = TRUE is more careful than FORCE: it still uses any load metadata that exists to avoid duplicates, and it also tries the files whose metadata has expired.

    Checkpoint 3 of 10· Check yourself

    A staged CSV file has five columns. The target table has three, and they are in a different order from the file. What is the most direct way to load it with COPY INTO?

    Sources324

    4.Loading semi-structured files

    Semi-structured files load the same way as CSV files: stage them, then COPY. The difference is the target column and the file type. Snowflake imports JSON, Avro, ORC, Parquet and XML. For JSON, Avro, Parquet and ORC it builds the nested hierarchy for you and stores it in a VARIANT column. You choose the target type in CREATE TABLE and the input format in the COPY's TYPE clause. The column types themselves are covered in VARIANT, OBJECT and ARRAY.

    A VARIANT column for the data and TYPE = 'JSON' for the filesql
    CREATE TABLE my_table (my_variant_column VARIANT); COPY INTO my_table ... FILE FORMAT = (TYPE = 'JSON') ...

    Putting everything in one VARIANT column is not the only option. You can also pull fields out into separate typed columns during the load. Snowflake can detect the column definitions in staged semi-structured files, so you can create the table from them instead of typing each column. For Parquet in the Snowsight wizard, this is the choice made by the Load as a single variant column? checkbox. Split the data across columns when a single value would need more than about 128 MB.

    Checkpoint 4 of 10· Fill the gap

    A team is loading staged JSON files with nested objects and arrays. They want Snowflake to build the hierarchy for them and keep it in a single column. Which column type completes the CREATE TABLE?

    CREATE TABLE my_table (my_variant_column  ? ); COPY INTO my_table ... FILE FORMAT = (TYPE = 'JSON') ...

    Sources5

    5.Finding and fixing load errors

    Troubleshooting starts with what already happened. The COPY_HISTORY function shows the load activity for a table. Its STATUS column tells you whether each set of files was loaded, partially loaded, or failed. FIRST_ERROR_MESSAGE gives the reason. As the name says, it holds only the first error, so a file with ten different problems shows one.

    To see every error, run the COPY again with VALIDATION_MODE = RETURN_ALL_ERRORS. With VALIDATION_MODE set, the COPY checks the files and reports problems without loading any data. You can then unload the rejected records to a file, fix them, and stage the corrected file. After a load that ran with ON_ERROR = CONTINUE, the VALIDATE function returns the errors from that earlier load.

    Validate a file, then unload its rejected records for repairsql
    COPY INTO mytable
      FROM @mystage/myfile.csv.gz
      VALIDATION_MODE=RETURN_ALL_ERRORS;
    
    SET qid=last_query_id();
    
    COPY INTO @mystage/errors/load_errors.txt FROM (SELECT rejected_record FROM TABLE(result_scan($qid)));

    ON_ERROR decides what a real load does when it meets a bad row, and the right value depends on how the files are produced.

    ON_ERROR values and when each one fits
    ValueBehaviourUse when
    ABORT_STATEMENTStops the load when an error is foundA partial load would be worse than no load
    CONTINUELoads the good rows and reports at most one error per file. ROWS_PARSED minus ROWS_LOADED is the number of rejected rowsThe files are machine-generated with no logical boundaries between them
    SKIP_FILESkips any file that contains an error. It buffers every file, so it is slower than CONTINUE or ABORT_STATEMENTEach file must load completely or not at all
    SKIP_FILE_num / 'SKIP_FILE_num%'Skips a file only when its error rows reach a count or a percentageA few bad rows are acceptable but many are not

    Some errors come from the file format rather than the data, and ON_ERROR cannot fix those. A common one is Number of columns in file (6) does not match that of the corresponding table (5), raised when every row has a trailing field the table has no column for. With CONTINUE, every row would be rejected. The fix belongs in the CSV file format: ERROR_ON_COLUMN_COUNT_MISMATCH = FALSE. With that set, the load continues, the fields that have a matching column load in file order, and the extra fields are dropped. If a record has fewer fields than the table has columns, the missing columns are loaded as NULL. Two limits apply. Records of different lengths within one file still raise an error. And the option is ignored when the COPY transforms data with a SELECT, because a SELECT already chooses its columns explicitly.

    Checkpoint 5 of 10· Fill the gap

    Before trying the load again, an engineer wants to see every error in myfile.csv.gz without loading any rows. Then they want to unload the rejected records so they can be fixed. Which copy option completes the first statement?

    COPY INTO mytable
      FROM @mystage/myfile.csv.gz
       ? =RETURN_ALL_ERRORS;
    
    SET qid=last_query_id();
    
    COPY INTO @mystage/errors/load_errors.txt FROM (SELECT rejected_record FROM TABLE(result_scan($qid)));

    Sources637

    6.External tables: querying files without loading them

    An external table lets you query files in an external stage as if they were a table, without loading them. Snowflake stores file-level metadata, such as file names and version identifiers, but the data stays in your cloud storage. Any format COPY can load works except XML. External tables are read-only: you can query them, join them and build views on them, but INSERT, UPDATE and DELETE are not allowed.

    You do not need to know the file's schema to create one, only its file format. Every external table has a VALUE column, a VARIANT that holds one row of the file, plus the pseudocolumns METADATA$FILENAME and METADATA$FILE_ROW_NUMBER. SELECT * returns only VALUE. If you know the schema, define virtual columns as expressions on VALUE. Those columns are type-checked when the data is scanned. If a file fails during a query, Snowflake skips it and moves on to the next file, so a query can return a partial result without raising an error.

    Performance is the trade-off. Queries on an external table can be slower than on native tables, and partitioning is the main fix. A partition column is an expression that parses METADATA$FILENAME. For example, a path such as .../2026/10/20/ gives a date column. A query that filters on that column then reads only the matching files. Partition columns are fixed when the table is created. For large files, a materialized view over the external table makes queries faster, and for Parquet, Apache Iceberg™ tables are faster still.

    Partition columns defined as expressions in CREATE EXTERNAL TABLEsql
    CREATE EXTERNAL TABLE
      <table_name>
         ( <part_col_name> <col_type> AS <part_expr> )
         [ , ... ]
      [ PARTITION BY ( <part_col_name> [, <part_col_name> ... ] ) ]
      ..

    An external table only knows about the files listed in its metadata, so that metadata has to be refreshed. It is refreshed automatically when the table is created. After that, the owner can set it to refresh automatically when new or changed files arrive in the stage, or run ALTER EXTERNAL TABLE ... REFRESH by hand. Tables created with PARTITION_TYPE = USER_SPECIFIED work differently. They are typically used to stay in sync with a metastore such as AWS Glue or Apache Hive. The owner adds each partition with ALTER EXTERNAL TABLE ... ADD PARTITION, and a manual refresh on this type of table produces an error.

    Recommended file sizes for parallel scans of external tables
    FormatRecommended size
    Parquet files256 - 512 MB
    Parquet row groups16 - 256 MB
    All other supported formats16 - 256 MB

    Checkpoint 6 of 10· Check yourself

    Several rows returned by the external table ext_orders have wrong values. The table reads JSON files in an S3 external stage. How should the data engineer correct them?

    Sources8

    7.Changing loaded tables with INSERT and UPDATE

    A table filled by COPY is an ordinary table, so standard DML changes it. INSERT adds rows, either as literal values or from a SELECT. The SELECT can also convert data on the way in, for example INSERT INTO my_table (my_variant_column) SELECT PARSE_JSON('{...}'); turns JSON text into a VARIANT value. DELETE removes rows, and as the COPY section showed, it does not clear load metadata.

    UPDATE takes an optional FROM clause that joins other tables, either to choose which rows to update or to supply the new values. Two details cause most surprises. First, an UPDATE without WHERE changes every row. Second, a target row can match more than one row in the joined table. With the default ERROR_ON_NONDETERMINISTIC_UPDATE = FALSE, Snowflake picks one of the matches without telling you which, so the result can differ from one run to the next. Set the parameter to TRUE to get an error instead.

    UPDATE syntax with FROM for joined tablessql
    UPDATE <target_table>
           SET <col_name> = <value> [ , <col_name> = <value> , ... ]
            [ FROM <additional_tables> ]
            [ WHERE <condition> ]

    DML is all or nothing by default: if one row fails, the whole statement ends and its changes are rolled back. DML error logging works more like ON_ERROR = CONTINUE. Create or alter the table with ERROR_LOGGING = true. Rows that fail a cast, break a NOT NULL constraint or are too long for their column then go to an error table, and the valid rows are written. You read the failed rows with SELECT * FROM ERROR_TABLE(table_name), which returns the error code, the message and the rejected values. Logging is active only when the table property is TRUE and the session parameter OPT_OUT_ERROR_LOGGING is FALSE.

    A table that sends failed rows to its error table instead of rolling backsql
    CREATE TABLE test_dml_error_logging( n NUMBER(4, 0) NOT NULL, t VARCHAR(5) ) ERROR_LOGGING = true;

    Checkpoint 7 of 10· Check yourself

    Although orders_clean was created with ERROR_LOGGING = true, an INSERT containing one row that breaks a NOT NULL constraint fails, and none of its rows are written. Which setting most likely explains this?

    Checkpoint 8 of 10· Exam question

    An analyst must load a 1.2 GB CSV export into the SALES_RAW table. The Snowsight 'Load data into a table' wizard rejects the file because it is too large. The analyst's role can create stages and has INSERT on the table. Which approach gets the file loaded?

    Checkpoint 9 of 10· Exam question

    A COPY INTO customers command for customers_2026.csv fails with the error Number of columns in file (6) does not match that of the corresponding table (5). The sixth field is a trailing notes column that the analyst does not need. Which change loads the first five fields of every row?

    Checkpoint 10 of 10· Exam question

    After a faulty transformation, an analyst runs DELETE FROM orders;, corrects the file format, and re-runs the same COPY INTO orders FROM @orders_stage a few hours later. The earlier load had succeeded, the staged files are unchanged, and the result shows Copy executed with 0 files processed. What should the analyst add to reload the files?

    Sources952

    Practise it for real

    Find every bad record in a staged CSV file and save the rejected records to a file for repair, without loading any rows

    1. 1.Run COPY INTO mytable FROM @mystage/myfile.csv.gz VALIDATION_MODE=RETURN_ALL_ERRORS;

      Why: COPY_HISTORY's FIRST_ERROR_MESSAGE shows only the first error. Validation lists every one without loading data.

      You should see: One result row per error, including the rejected record, and mytable unchanged

    2. 2.Run SET qid=last_query_id(); straight after the validation

      Why: RESULT_SCAN needs the query ID of the validation, so no other statement can run in between.

      You should see: The session variable qid holds the ID of the validation query

    3. 3.Run COPY INTO @mystage/errors/load_errors.txt FROM (SELECT rejected_record FROM TABLE(result_scan($qid)));

      Why: Unloading the rejected records gives you a file to compare against the source and fix.

      You should see: A load_errors file under @mystage/errors/ containing only the bad records

    Stuck? Get a nudge

    If the errors all say the column count does not match, the problem is the file format, not the data. Set ERROR_ON_COLUMN_COUNT_MISMATCH instead of editing rows.

    Sources

    (9)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “You can upload up to 250 files at a time. Each file can be up to 250 MB.”
      ↩︎ Loading files through Snowsight
      “To load larger files, or a large number of files, use Snowflake CLI.”
      ↩︎ Loading files through Snowsight
      “returns the file format and column definitions identified by the INFER_SCHEMA function”
      ↩︎ Loading files through Snowsight
      “Snowflake runs all SQL commands in an explicit transaction”
      ↩︎ Loading files through Snowsight
      “By default, no data is loaded from the file.”
      ↩︎ Loading files through Snowsight
      “you must wait for the warehouse to resume (up to 5 minutes) before data is loaded”
      ↩︎ Loading files through Snowsight
      “To load larger files, or a large number of files, use Snowflake CLI.”
      ↩︎ Exam trap 1
      “Each file can be up to 250 MB. To load larger files, or a large number of files, use Snowflake CLI.”
      ↩︎ Checkpoint
    2. 2.
      “Upload files to any of the internal stage types from your local file system using the PUT command.”
      ↩︎ Stages: where files wait before loading
      “A table stage has no grantable privileges of its own.”
      ↩︎ Stages: where files wait before loading
      “You cannot access data held in archival cloud storage classes that requires restoration before it can be retrieved.”
      ↩︎ Stages: where files wait before loading
      “There is no requirement for your data files to have the same number and ordering of columns as your target table.”
      ↩︎ Loading staged files with COPY INTO
      “Bulk loading relies on user-provided virtual warehouses, which are specified in the COPY statement.”
      ↩︎ Loading staged files with COPY INTO
      “the DML operation ends and the changes made by the DML statement are rolled back”
      ↩︎ Changing loaded tables with INSERT and UPDATE
      “Snowflake refers to the location of data files in cloud storage as a stage.”
      ↩︎ Key concept
      “This stage type is designed to store files that are staged and managed by one or more users but only loaded into a single table.”
      ↩︎ Checkpoint
      “Errors are logged in an error table that is associated with the base table.”
      ↩︎ Prediction
      “The OPT_OUT_ERROR_LOGGING parameter is set to FALSE for the current session.”
      ↩︎ Checkpoint
    3. 3.
      “@[<namespace>.]%<table_name>[/<path>] | @~[/<path>]”
      ↩︎ Stages: where files wait before loading
      “Loads data from files to an existing table.”
      ↩︎ Loading staged files with COPY INTO
      “To view all the errors in the data files, use the VALIDATION_MODE parameter or query the VALIDATE function.”
      ↩︎ Finding and fixing load errors
      “SKIP_FILE is slower than either CONTINUE or ABORT_STATEMENT.”
      ↩︎ Finding and fixing load errors
    4. 4.
      “Note that this option reloads files, potentially duplicating data in a table.”
      ↩︎ Loading staged files with COPY INTO
      “To load files whose metadata has expired, set the LOAD_UNCERTAIN_FILES copy option to true.”
      ↩︎ Loading staged files with COPY INTO
      “to prevent accidental reload, the command skips the file by default.”
      ↩︎ Loading staged files with COPY INTO
      “set the FORCE option to load all files, ignoring load metadata if it exists”
      ↩︎ Exam trap 2
      “set the FORCE option to load all files, ignoring load metadata if it exists”
      ↩︎ Prediction
    5. 5.
      “Snowflake can import semi-structured data from JSON, Avro, ORC, Parquet, and XML formats”
      ↩︎ Loading semi-structured files
      “Use Snowflake to automatically detect and retrieve the column definitions from staged semi-structured data files.”
      ↩︎ Loading semi-structured files
      “to convert JSON-formatted data to a VARIANT value, call PARSE_JSON”
      ↩︎ Changing loaded tables with INSERT and UPDATE
    6. 6.
      “The STATUS column indicates whether a particular set of files was loaded, partially loaded, or failed to load.”
      ↩︎ Finding and fixing load errors
      “No data is loaded when this copy option is specified.”
      ↩︎ Finding and fixing load errors
      “No data is loaded when this copy option is specified.”
      ↩︎ Exam trap 4
    7. 7.
      “If set to FALSE, an error is not generated and the load continues.”
      ↩︎ Finding and fixing load errors
      “When transforming data during loading (i.e. using a query as the source for the COPY command), this option is ignored.”
      ↩︎ Finding and fixing load errors
      “the matching fields are loaded in order of occurrence in the file and the remaining fields are not loaded”
      ↩︎ Exam trap 3
    8. 8.
      “query data stored in an external stage as if the data were inside a table in Snowflake.”
      ↩︎ External tables: querying files without loading them
      “A VARIANT type column that represents a single row in the external file.”
      ↩︎ External tables: querying files without loading them
      “expressions that parse the path or filename information stored in the METADATA$FILENAME pseudocolumn”
      ↩︎ External tables: querying files without loading them
      “configure the metadata to refresh automatically when new or updated data files are available in the external stage”
      ↩︎ External tables: querying files without loading them
      “Attempting to manually refresh this type of external table produces a user error.”
      ↩︎ External tables: querying files without loading them
      “To improve query performance, you can use a materialized view based on an external table.”
      ↩︎ External tables: querying files without loading them
      “External tables are read-only.”
      ↩︎ Exam trap 5
      “External tables are read-only. You can’t perform data manipulation language (DML) operations on external tables.”
      ↩︎ Checkpoint
    9. 9.
      “Specifies one or more tables to use for selecting rows to update or for setting new values.”
      ↩︎ Changing loaded tables with INSERT and UPDATE
      “If FALSE (default value), no error is returned and one of the joined rows is used to update the target row”
      ↩︎ Changing loaded tables with INSERT and UPDATE

    Ready to test yourself?

    Practise the 8 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.