Reputation: 21
Can I create multi columns partition in snowflake external table partition by ( date, time)?
also is it possible to create partition table from table columns( such name, create date etc). all the document is indicating use metdata$filename column to create the partition column.
Upvotes: 1
Views: 1382
Reputation: 1530
External table partition is based on the file paths, which is stored as metadata$filename to the external table.
Yes, you can define multiple columns as partitions for Snowflake's external tables like "partition by (date, time)", but they need to be from the metadata, not the actual data column in the external table file, because they are not used to partition the actual files.
Upvotes: 2
Reputation: 524
A partition column definition is an expression that parses the column metadata in the internal (hidden) METADATA$EXTERNAL_TABLE_PARTITION column. As of now if you want to use any column from your data files, you need to define the column in the form of Metadata$external_table.
https://docs.snowflake.com/en/sql-reference/sql/create-external-table.html#partitioning-parameters
You can create multiple partitions like data and time however, you need to be selective to make sure that the partition you are specifying is more performant.
Upvotes: 1