0

how can we create table in snowflake without running create table query, directly our snowpipe will detect data format and will create a table for us.

Answer for my query related to snowflake

1 Answers1

1

This is not possible automatically as of today.

There is a possibility to create a table for semi-structured data by using a template and inferring the file schema (this feature is currently limited to Apache Parquet, Apache Avro, and ORC files), like this example:

CREATE TABLE mytable
  USING TEMPLATE (
    SELECT ARRAY_AGG(OBJECT_CONSTRUCT(*))
    WITHIN GROUP (ORDER BY ORDER_ID)
      FROM TABLE(
        INFER_SCHEMA(
          LOCATION=>'@mystage',
          FILE_FORMAT=>'my_parquet_format'
        )
      ));

For more information have a look at the CREATE TABLE syntax and INFER_SCHEMA function.

Sergiu
  • 4,039
  • 1
  • 13
  • 21