Skip to main content

Snowflake_Connection.create_table

create_tabletable_name structure primary_key temporary allow_existing on_problems

Group: Output

Documentation

Creates a new empty table in the database and returns a query referencing the new table.

Arguments

  • table_name: the name of the table to create.
  • structure: the structure of the table, provided as either an existing Table (no data will be copied) or a Vector of Column_Description.
  • primary_key: the names of the columns to use as the primary key. The first column from the table is used by default. If it is set to Nothing or an empty vector, no primary key will be created.
  • temporary: if set to True, the table will be temporary, meaning that it will be dropped once the connection is closed. Defaults to False.
  • allow_existing: Defaults to False, meaning that if the table with the provided name already exists, an error will be raised. If set to True, the existing table will be returned instead. Note that the existing table is not guaranteed to have the same structure as the one provided.
  • on_problems: the behavior to use when encountering non-fatal problems. Defaults to reporting them as warning.

Errors

  • If a table with the given name already exists, then a Table_Already_Exists error is raised.
  • If a column type is not supported and is coerced to a similar supported type, an Inexact_Type_Coercion problem is reported according to the on_problems setting.
  • If a column type is not supported and there is no replacement (e.g. native Enso types), an Unsupported_Type error is raised.
  • If the provided primary key columns are not present in table structure provided, Missing_Input_Columns error is raised.
  • An SQL_Error may be reported if there is a failure on the database side.

Remarks

Dry Run if Output disabled

If performing output actions is disabled, only a dry run is performed and no permanent changes occur. The operation will test for errors (like missing columns) and if successful, return a temporary table with a Dry_Run_Operation warning attached.