Writing data to Snowflake external tables

Writing data to Snowflake external tables

Create a mapping to update an external table

Create a mapping to update an external table

You are a sales analyst and you want to update a Snowflake external table with the product order details from a MySQL source.
Create a mapping to read the order details from the MySQL source, stage the data in Amazon S3, and update the metadata in the external table in Snowflake.
The following image shows an example of the mapping configurations required for this use case:
  1. Configure a Source transformation to read the order details from the MySQL source.
  2. Configure a Target transformation using Amazon S3 V2 connection to insert data from the MySQL source to an Amazon S3 staging file in the flat file format:
  3. Configure a Filter transformation and set the advanced condition to FALSE to restrict rows to pass to the Snowflake target transformation:
  4. Configure another Target transformation using Snowflake Data Cloud connection, select a placeholder empty Snowflake table as the target object, and enter a post-SQL query
    ALTER EXTERNAL TABLE REFRESH
    statement in the Snowflake Data Cloud advanced target properties:
    For example, enter the following command in the Post-SQL field to refresh the metadata for the order details in the Snowflake external table:
    ALTER EXTERNAL TABLE ORDER REFRESH
    For more information about the commands, see the Snowflake documentation: https://docs.snowflake.com/en/sql-reference/sql/alter-external-table.html
    You can then query the external table from Snowflake to view the updated order details in the S3 storage.

0 COMMENTS

We’d like to hear from you!