sqlcsvsnowflake-cloud-data-platformparquetstage

Exploring Data loaded to an internal stage in snowflake


Data was loaded to an internal stage called MY_CH07_STAGE in snowflake. To explore the data we have the query below.

What does t mean and what does t.$1, t.$2,t.$3,t.$4,t.$5 and t.$6 mean?

select t.$1, t.$2,t.$3,t.$4,t.$5,t.$6
from @MY_CH07_STAGE (file_format => 'my_stage_file_format') t;

Solution

  • t is the alias to the "table" in this case the stage, and the format of the files found in there.

    The .$1 is the first column of values.

    For example from the Parquet data loading example

    copy into cities
     from (select $1:continent::varchar,
                  $1:country:name::varchar,
                  $1:country:city::variant
          from @sf_tut_stage/cities.parquet);
    

    Note the following:

    $1 in the SELECT query refers to the single column where the Paraquet data is stored.

    thus the $2 to $6 are the 2nd to 6th columns in the files column format.