iceberg_tables
Creates, updates, deletes, gets or lists a iceberg_tables
resource.
Overview
Name | iceberg_tables |
Type | Resource |
Id | snowflake.iceberg_table.iceberg_tables |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the iceberg table |
auto_refresh | boolean | Specifies whether to automatically refresh the table metadata |
base_location | string | The path to a directory where Snowflake can write data and metadata files for the table. |
can_write_metadata | string | Signifies whether Snowflake can write metadata to the location specified by the file_path. |
catalog | string | Name of the catalog integration to use for iceberg tables |
catalog_namespace | string | Catalog namespace for the table. The namespace defined when the table was created. Otherwise, the default namespace associated with the catalog integration used by the table. If you’re syncing the table to Snowflake Open Catalog, the default is null. |
catalog_sync | string | Name of the catalog integration to sync this table |
catalog_table_name | string | Name of the table as recognized by the catalog. |
change_tracking | boolean | True if change tracking is enabled, allowing streams and CHANGES to be used on the entity. |
cluster_by | array | Specifies one or more columns or column expressions in the table as the clustering key. |
columns | array | |
comment | string | user comment associated to an object in the dictionary |
constraints | array | |
created_on | string | Date and time when the iceberg table was created. |
data_retention_time_in_days | integer | number of days to retain the old version of deleted/updated data |
database_name | string | Database in which the iceberg table is stored |
external_volume | string | Name of an external volume that will be used for persisted Iceberg metadata and data files. |
iceberg_table_type | string | Type of Iceberg table. UNMANAGED if the table is not managed by Snowflake. NOT ICEBERG otherwise. |
max_data_extension_time_in_days | integer | Maximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale. |
metadata_file_path | string | Specifies the relative path of the Iceberg metadata file to use for column definitions. |
owner | string | Role that owns the iceberg table |
owner_role_type | string | The type of role that owns the iceberg table |
replace_invalid_characters | boolean | Specifies whether to replace invalid characters in the column names |
schema_name | string | Schema in which the iceberg table is stored |
storage_serialization_policy | string | Storage serialization policy used for managed Iceberg table. This include encodings and compressions |
Methods
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
fetch_iceberg_table | SELECT | database_name, name, schema_name, endpoint | - | Describe an iceberg table |
list_iceberg_tables | SELECT | database_name, schema_name, endpoint | like , startsWith , showLimit , fromName , deep | Lists the Apache Iceberg™ tables for which you have access privileges. |
create_snowflake_managed_iceberg_table | INSERT | database_name, schema_name, data__name, endpoint | createMode , copyGrants | Create a snowflake managed iceberg table (clone and undrop are separate subresources) |
drop_iceberg_table | DELETE | database_name, name, schema_name, endpoint | ifExists , type | Drop an iceberg table |
clone_snowflake_managed_iceberg_table | EXEC | database_name, name, schema_name, data__name, endpoint | createMode , copyGrants , targetDatabase , targetSchema | Clone a snowflake managed iceberg table |
convert_to_managed_iceberg_table | EXEC | database_name, name, schema_name, endpoint | ifExists | Convert unmanaged iceberg table to managed iceberg table |
create_snowflake_managed_iceberg_table_as_select | EXEC | database_name, query, schema_name, data__base_location, data__name, endpoint | createMode , copyGrants | Create a snowflake managed iceberg table as select |
create_snowflake_managed_iceberg_table_like | EXEC | database_name, name, schema_name, data__name, endpoint | createMode , copyGrants , targetDatabase , targetSchema | Creates a new table with the same column definitions as an existing table, but without copying data from the existing table. |
create_unmanaged_iceberg_table_from_aws_glue_catalog | EXEC | database_name, schema_name, data__catalog_table_name, data__name, endpoint | createMode | Create an unmanaged iceberg table from AWS Glue catalog |
create_unmanaged_iceberg_table_from_delta | EXEC | database_name, schema_name, data__base_location, data__name, endpoint | createMode | Create an unmanaged iceberg table from Delta |
create_unmanaged_iceberg_table_from_iceberg_files | EXEC | database_name, schema_name, data__metadata_file_path, data__name, endpoint | createMode | Create an unmanaged iceberg table from Iceberg files |
create_unmanaged_iceberg_table_from_iceberg_rest | EXEC | database_name, schema_name, data__catalog_table_name, data__name, endpoint | createMode | Create an unmanaged iceberg table from Iceberg REST |
refresh_iceberg_table | EXEC | database_name, name, schema_name, endpoint | ifExists | Refreshes the metadata for an Apache Iceberg table that uses an external Iceberg catalog |
resume_recluster_iceberg_table | EXEC | database_name, name, schema_name, endpoint | ifExists | Resume recluster of an iceberg table (iceberg tables managed by an external catalog do not allow clustering) |
suspend_recluster_iceberg_table | EXEC | database_name, name, schema_name, endpoint | ifExists | Suspend recluster of an iceberg table (iceberg tables managed by an external catalog do not allow clustering) |
undrop_iceberg_table | EXEC | database_name, name, schema_name, endpoint | - | Undrop an iceberg table |
Optional Parameter Details
Name | Description | Type | Default |
---|---|---|---|
copyGrants | Query parameter to enable copy grants when creating the object. | boolean | false |
createMode | Query parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists : Throws an error if you try to create a resource that already exists. - orReplace : Automatically replaces the existing resource with the current one. - ifNotExists : Creates a new resource when an alter is requested for a non-existent resource. | string | errorIfExists |
deep | Optionally includes dependency information of the table. | boolean | - |
fromName | Query parameter to enable fetching rows only following the first row whose object name matches the specified string. Case-sensitive and does not have to be the full name. | string | - |
ifExists | Query parameter that specifies how to handle the request for a resource that does not exist: - true : The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false : The endpoint throws an error if the resource doesn't exist. | boolean | false |
like | Query parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. | string | - |
showLimit | Query parameter to limit the maximum number of rows returned by a command. | integer | - |
startsWith | Query parameter to filter the command output based on the string of characters that appear at the beginning of the object name. Uses case-sensitive pattern matching. | string | - |
targetDatabase | Database of the newly created table. Defaults to the source table's database. | string | - |
targetSchema | Schema of the newly created table. Defaults to the source table's schema. | string | - |
type | Specifies whether the table can be dropped if foreign keys exist that reference the table. | string | - |
SELECT
examples
Lists the Apache Iceberg™ tables for which you have access privileges.
SELECT
name,
auto_refresh,
base_location,
can_write_metadata,
catalog,
catalog_namespace,
catalog_sync,
catalog_table_name,
change_tracking,
cluster_by,
columns,
comment,
constraints,
created_on,
data_retention_time_in_days,
database_name,
external_volume,
iceberg_table_type,
max_data_extension_time_in_days,
metadata_file_path,
owner,
owner_role_type,
replace_invalid_characters,
schema_name,
storage_serialization_policy
FROM snowflake.iceberg_table.iceberg_tables
WHERE database_name = '{{ database_name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';
INSERT
example
Use the following StackQL query and manifest file to create a new iceberg_tables
resource.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO snowflake.iceberg_table.iceberg_tables (
data__name,
data__comment,
data__change_tracking,
data__max_data_extension_time_in_days,
data__external_volume,
data__data_retention_time_in_days,
data__catalog_sync,
data__catalog,
data__storage_serialization_policy,
data__catalog_table_name,
data__catalog_namespace,
data__cluster_by,
data__columns,
data__base_location,
data__replace_invalid_characters,
data__metadata_file_path,
data__constraints,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ comment }}',
'{{ change_tracking }}',
'{{ max_data_extension_time_in_days }}',
'{{ external_volume }}',
'{{ data_retention_time_in_days }}',
'{{ catalog_sync }}',
'{{ catalog }}',
'{{ storage_serialization_policy }}',
'{{ catalog_table_name }}',
'{{ catalog_namespace }}',
'{{ cluster_by }}',
'{{ columns }}',
'{{ base_location }}',
'{{ replace_invalid_characters }}',
'{{ metadata_file_path }}',
'{{ constraints }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
/*+ create */
INSERT INTO snowflake.iceberg_table.iceberg_tables (
data__name,
database_name,
schema_name,
endpoint
)
SELECT
'{{ name }}',
'{{ database_name }}',
'{{ schema_name }}',
'{{ endpoint }}'
;
- name: iceberg_tables
props:
- name: database_name
value: string
- name: schema_name
value: string
- name: data__name
value: string
- name: endpoint
value: string
- name: name
value: string
- name: comment
value: string
- name: change_tracking
value: boolean
- name: max_data_extension_time_in_days
value: integer
- name: external_volume
value: string
- name: data_retention_time_in_days
value: integer
- name: catalog_sync
value: string
- name: catalog
value: string
- name: storage_serialization_policy
value: string
- name: catalog_table_name
value: string
- name: catalog_namespace
value: string
- name: cluster_by
value: array
- name: columns
value: array
props:
- name: name
value: string
- name: datatype
value: string
- name: comment
value: string
- name: nullable
value: boolean
- name: default_value
value: string
- name: base_location
value: string
- name: replace_invalid_characters
value: boolean
- name: metadata_file_path
value: string
- name: constraints
value: array
props:
- name: name
value: string
- name: column_names
value: array
- name: constraint_type
value: string
DELETE
example
Deletes the specified iceberg_tables
resource.
/*+ delete */
DELETE FROM snowflake.iceberg_table.iceberg_tables
WHERE database_name = '{{ database_name }}'
AND name = '{{ name }}'
AND schema_name = '{{ schema_name }}'
AND endpoint = '{{ endpoint }}';