snowflake.core.iceberg_table.IcebergTableCollection¶
- class snowflake.core.iceberg_table.IcebergTableCollection(schema: SchemaResource)¶
- Bases: - SchemaObjectCollectionParent[- IcebergTableResource]- Represents the collection operations on the Snowflake Iceberg table resource. - With this collection, you can create, iterate through, and search for Iceberg tables that you have access to in the current context. - Examples - Creating an IcebergTable instance: - >>> iceberg_tables = root.databases["my_db"].schemas["my_schema"].iceberg_tables >>> new_iceberg_table = IcebergTable( ... name="name", columns=[IcebergTableColumn(name="col1", datatype="string")] ... ) >>> iceberg_tables.create(new_iceberg_table) - Attributes - database¶
- The DatabaseResource this collection belongs to. 
 - root¶
- The Root object this collection belongs to. 
 - Methods - create(iceberg_table: IcebergTable, *, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource¶
- create(iceberg_table: IcebergTable, *, as_select: str | None = None, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, like: str, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, from_aws_glue_catalog: Literal[True] = True, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, from_delta: Literal[True] = True, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, from_iceberg_files: Literal[True] = True, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, from_iceberg_rest: Literal[True] = True, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- create(iceberg_table: IcebergTable, *, clone_iceberg_table: str | Clone, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) IcebergTableResource
- Create an Iceberg table in Snowflake. - There are multiple ways to create an Iceberg table:
- by building from scratch 
- by creating from select query 
- by creating it from AWS Glue Catalog or Delta catalog 
- by creating it from files 
- by creating it from REST API 
- by cloning existing table 
 
 - Parameters:
- iceberg_table (Union[IcebergTable, str]) – The new Iceberg table’s name. 
- as_select (str) – Creates an Iceberg table using a select query. 
- like (str) – Create a new Iceberg table like the specified one, but empty. 
- from_aws_glue_catalog (IcebergTableFromAwsGlueCatalog) – Creates an Iceberg table from AWS Glue Catalog. 
- from_delta (IcebergTableFromDelta) – Creates an Iceberg table from Delta. 
- from_iceberg_files (IcebergTableFromIcebergFiles) – Creates an Iceberg table using Iceberg files in object storage (external cloud storage). 
- from_iceberg_rest (IcebergTableFromIcebergRest) – Creates an Iceberg in Iceberg REST catalog. 
- clone_iceberg_table (str or Clone object) – The name of Iceberg table to be cloned, or a - Cloneobject which would contain the name of the Iceberg table with support to clone at a specific time.
- copy_grants (bool, optional) – Copy grants when resource is created. 
- mode (CreateMode, optional) – - One of the following enum values: - CreateMode.error_if_exists: Throw an- snowflake.core.exceptions.ConflictErrorif the Iceberg table already exists in Snowflake. Equivalent to SQL- create Iceberg table <name> ....- CreateMode.or_replace: Replace if the Iceberg table already exists in Snowflake. Equivalent to SQL- create or replace Iceberg table <name> ....- CreateMode.if_not_exists: Do nothing if the Iceberg table already exists in Snowflake. Equivalent to SQL- create Iceberg table <name> if not exists...- Default is - CreateMode.error_if_exists.
 
 - Examples - Creating an Iceberg table, replacing any existing Iceberg table with the same name: - >>> iceberg_tables = root.databases["my_db"].schemas["my_schema"].iceberg_tables >>> new_iceberg_table = IcebergTable( ... name="name", columns=[IcebergTableColumn(name="col1", datatype="string")] ... ) >>> iceberg_tables.create(new_iceberg_table, mode=CreateMode.or_replace) - Cloning an Iceberg table instance: - >>> iceberg_tables = root.databases["my_db"].schemas["my_schema"].iceberg_tables >>> iceberg_tables.create( ... IcebergTable(name="new_table"), ... clone_iceberg_table="iceberg_table_name_to_be_cloned", ... mode=CreateMode.if_not_exists, ... ) 
 - create_async(iceberg_table: IcebergTable, *, as_select: str | None = None, like: str | None = None, from_aws_glue_catalog: bool | None = False, from_delta: bool | None = False, from_iceberg_files: bool | None = False, from_iceberg_rest: bool | None = False, clone_iceberg_table: str | Clone | None = None, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) PollingOperation[IcebergTableResource]¶
- An asynchronous version of - create().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - items() ItemsView[str, T]¶
 - iter(*, like: Annotated[str, Strict(strict=True)] | None = None, starts_with: Annotated[str, Strict(strict=True)] | None = None, show_limit: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1), Le(le=10000)])] | None = None, from_name: Annotated[str, Strict(strict=True)] | None = None) Iterator[IcebergTable]¶
- Iterate through - IcebergTableobjects from Snowflake, filtering on any optional ‘like’ pattern.- Parameters:
- like (str, optional) – A case-insensitive string functioning as a filter, with support for SQL wildcard characters (% and _). 
- starts_with (str, optional) – String used 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. 
- show_limit (int, optional) – Limit of the maximum number of rows returned by iter(). The default is - None, which behaves equivalently to show_limit=10000. This value must be between- 1and- 10000.
- from_name (str, optional) – Fetch rows only following the first row whose object name matches the specified string. This is case-sensitive and does not have to be the full name. 
 
 - Examples - Showing all Iceberg tables that you have access to see: - >>> iceberg_tables = iceberg_table_collection.iter() - Showing information of the exact Iceberg table you want to see: - >>> iceberg_tables = iceberg_table_collection.iter(like="your-iceberg-table-name") - Showing Iceberg tables starting with ‘your-iceberg-table-name-‘: - >>> iceberg_tables = iceberg_table_collection.iter(like="your-iceberg-table-name-%") - Using a for loop to retrieve information from iterator: - >>> for iceberg_table in iceberg_tables: ... print(iceberg_table.name) 
 - iter_async(*, like: Annotated[str, Strict(strict=True)] | None = None, starts_with: Annotated[str, Strict(strict=True)] | None = None, show_limit: Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1), Le(le=10000)])] | None = None, from_name: Annotated[str, Strict(strict=True)] | None = None) PollingOperation[Iterator[IcebergTable]]¶
- An asynchronous version of - iter().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - keys() KeysView[str]¶
 - update_reference(old_name: str, new_name: str, resource: T) None¶
- Update the collection with a new item. 
 - values() ValuesView[T]¶