Skip to main content

iceberg_tables

Creates, updates, deletes, gets or lists a iceberg_tables resource.

Overview

Nameiceberg_tables
TypeResource
Idsnowflake.iceberg_table.iceberg_tables

Fields

NameDatatypeDescription
namestringName of the iceberg table
auto_refreshbooleanSpecifies whether to automatically refresh the table metadata
base_locationstringThe path to a directory where Snowflake can write data and metadata files for the table.
can_write_metadatastringSignifies whether Snowflake can write metadata to the location specified by the file_path.
catalogstringName of the catalog integration to use for iceberg tables
catalog_namespacestringCatalog 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_syncstringName of the catalog integration to sync this table
catalog_table_namestringName of the table as recognized by the catalog.
change_trackingbooleanTrue if change tracking is enabled, allowing streams and CHANGES to be used on the entity.
cluster_byarraySpecifies one or more columns or column expressions in the table as the clustering key.
columnsarray
commentstringuser comment associated to an object in the dictionary
constraintsarray
created_onstringDate and time when the iceberg table was created.
data_retention_time_in_daysintegernumber of days to retain the old version of deleted/updated data
database_namestringDatabase in which the iceberg table is stored
external_volumestringName of an external volume that will be used for persisted Iceberg metadata and data files.
iceberg_table_typestringType of Iceberg table. UNMANAGED if the table is not managed by Snowflake. NOT ICEBERG otherwise.
max_data_extension_time_in_daysintegerMaximum number of days to extend data retention beyond the retention period to prevent a stream becoming stale.
metadata_file_pathstringSpecifies the relative path of the Iceberg metadata file to use for column definitions.
ownerstringRole that owns the iceberg table
owner_role_typestringThe type of role that owns the iceberg table
replace_invalid_charactersbooleanSpecifies whether to replace invalid characters in the column names
schema_namestringSchema in which the iceberg table is stored
storage_serialization_policystringStorage serialization policy used for managed Iceberg table. This include encodings and compressions

Methods

NameAccessible byRequired ParamsOptional ParamsDescription
fetch_iceberg_tableSELECTdatabase_name, name, schema_name, endpoint-Describe an iceberg table
list_iceberg_tablesSELECTdatabase_name, schema_name, endpointlike, startsWith, showLimit, fromName, deepLists the Apache Iceberg™ tables for which you have access privileges.
create_snowflake_managed_iceberg_tableINSERTdatabase_name, schema_name, data__name, endpointcreateMode, copyGrantsCreate a snowflake managed iceberg table (clone and undrop are separate subresources)
drop_iceberg_tableDELETEdatabase_name, name, schema_name, endpointifExists, typeDrop an iceberg table
clone_snowflake_managed_iceberg_tableEXECdatabase_name, name, schema_name, data__name, endpointcreateMode, copyGrants, targetDatabase, targetSchemaClone a snowflake managed iceberg table
convert_to_managed_iceberg_tableEXECdatabase_name, name, schema_name, endpointifExistsConvert unmanaged iceberg table to managed iceberg table
create_snowflake_managed_iceberg_table_as_selectEXECdatabase_name, query, schema_name, data__base_location, data__name, endpointcreateMode, copyGrantsCreate a snowflake managed iceberg table as select
create_snowflake_managed_iceberg_table_likeEXECdatabase_name, name, schema_name, data__name, endpointcreateMode, copyGrants, targetDatabase, targetSchemaCreates 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_catalogEXECdatabase_name, schema_name, data__catalog_table_name, data__name, endpointcreateModeCreate an unmanaged iceberg table from AWS Glue catalog
create_unmanaged_iceberg_table_from_deltaEXECdatabase_name, schema_name, data__base_location, data__name, endpointcreateModeCreate an unmanaged iceberg table from Delta
create_unmanaged_iceberg_table_from_iceberg_filesEXECdatabase_name, schema_name, data__metadata_file_path, data__name, endpointcreateModeCreate an unmanaged iceberg table from Iceberg files
create_unmanaged_iceberg_table_from_iceberg_restEXECdatabase_name, schema_name, data__catalog_table_name, data__name, endpointcreateModeCreate an unmanaged iceberg table from Iceberg REST
refresh_iceberg_tableEXECdatabase_name, name, schema_name, endpointifExistsRefreshes the metadata for an Apache Iceberg table that uses an external Iceberg catalog
resume_recluster_iceberg_tableEXECdatabase_name, name, schema_name, endpointifExistsResume recluster of an iceberg table (iceberg tables managed by an external catalog do not allow clustering)
suspend_recluster_iceberg_tableEXECdatabase_name, name, schema_name, endpointifExistsSuspend recluster of an iceberg table (iceberg tables managed by an external catalog do not allow clustering)
undrop_iceberg_tableEXECdatabase_name, name, schema_name, endpoint-Undrop an iceberg table
Optional Parameter Details
NameDescriptionTypeDefault
copyGrantsQuery parameter to enable copy grants when creating the object.booleanfalse
createModeQuery 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.stringerrorIfExists
deepOptionally includes dependency information of the table.boolean-
fromNameQuery 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-
ifExistsQuery 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.booleanfalse
likeQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.string-
showLimitQuery parameter to limit the maximum number of rows returned by a command.integer-
startsWithQuery 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-
targetDatabaseDatabase of the newly created table. Defaults to the source table's database.string-
targetSchemaSchema of the newly created table. Defaults to the source table's schema.string-
typeSpecifies 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.

/*+ 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 }}'
;

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 }}';