Articles in this section

Export data from Snowflake

You can export data from Snowflake in either of two ways:

Use SQL to query data

You can use Snowflake SQL queries , or you can export data from Snowflake via  SQL queries that access semi-structured data using special operators and functions. The following example describes how to retrieve JSON data from Snowflake:

  • In Flow Builder , click Add source.

360069237331-image-0.png
  1. Select Snowflake as your source application, and choose the  Snowflake connection you want to use to export data.

  2. Click Next. The Create export panel opens.

360069007752-image-1.png
  1. Enter a name and optional description for the export.

  2. In the What would you like to export? section, enter your SQL query in the Query field. For more information on constructing queries, see the Snowflake  query documentation.

    Tip

    Click handlebars_editor.svg to open the Build SQL query editor and ask Celigo AI to generate a SQL query for you. Enter a description of your SQL query in plain English in the space provided, and Celigo AI will attempt to generate a SQL query based on your prompt.

    Note

    To successfully export extremely small or large floating-point numbers, use TO_CHAR (FLOATNUM). For example,

    "query": "select TO CHAR (FLOATNUM) from TEST_DEMODB.PUBLIC.ALLDATATYPES" 

Example query

select
value:first_name::string as "first name",
value:last_name::string as "last name",
value:city::string as "city",
value:zip::string as "zip"
from shopify_customer,
    lateral flatten(input => properties:addresses);

Example result

{
  "page_of_records": [
    {
      "record": {
         "first name": "Test",
         "last name": "Smith",
         "city": "Springfield",
         "zip": "55555"
       }
     ]
   }
}

Extract data via the COPY API into Amazon S3

If you already use S3 buckets for storing and managing your data files, you can use your existing buckets and folder paths when unloading data from Snowflake tables, and then retrieve that data with your Amazon S3 connection for use in a flow.

360069958191-Copy_Snowflake_File_to_S3.svg

Note

If you have not yet configured Snowflake to Amazon S3 storage integration, see the Snowflake documentation on S3 external storage . For information about unloading Snowflake data to Amazon S3, see the  Snowflake user guide.

If you have configured your Snowflake account to use Amazon S3 storage, enter the following command in the Query field to automatically copy Snowflake data to Amazon S3:

COPY INTO @my_ext_unload_stage/dl_file_prefix 
from Shopify_customer 
OVERWRITE = TRUE 
file_format = (format_name ='mycsvformat' compression='NONE');

Read more about this connection:

Group export records

The Grouping option allows you to manage your flow’s files by grouping records by field. This feature allows you to aggregate your data based on your chosen field(s).

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.