snowflake.core.table.TableCollection¶
- class snowflake.core.table.TableCollection(schema: SchemaResource)¶
Bases:
SchemaObjectCollectionParent
[TableResource
]Attributes
- database¶
- root¶
- schema¶
Methods
- __init__(schema: SchemaResource)¶
- create(table: Table | str, *, as_select: str | None = None, template: str | None = None, like_table: str | None = None, clone_table: str | Clone | None = None, copy_grants: bool | None = False, mode: CreateMode = CreateMode.error_if_exists) TableResource ¶
Create a table.
- Parameters:
table – The table object, together with the table’s properties, object parameters, columns, and constraints. It can either be a table name or a
Table
object when it’s used together with as_select, template, like_table, clone_table. It must be aTable
when it’s not used with these clauses.as_select – The as select clause.
template – The using template clause.
like_table – The like clause.
clone_table – The clone clause.
copy_grants – copy grants when clone_table is provided.
mode –
One of the following strings.
CreateMode.error_if_exists: Throw an
snowflake.core.exceptions.ConflictError
if the table already exists in Snowflake. Equivalent to SQLcreate table <name> ...
.CreateMode.or_replace: Replace if the task already exists in Snowflake. Equivalent to SQL
create or replace table <name> ...
.CreateMode.if_not_exists: Do nothing if the task already exists in Snowflake. Equivalent to SQL
create table <name> if not exists...
Default value is CreateMode.error_if_exists.
- Not currently implemented:
Row access policy
Column masking policy
Search optimization
Tags
Stage file format and copy options
- items() ItemsView[str, T] ¶
- iter(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None, from_name: str | None = None, history: bool = False, deep: bool = False) Iterator[Table] ¶
Search
Table
objects from Snowflake.- Parameters:
like – The pattern of the Table name. Use
%
to represent any number of characters and?
for a single character.startswith – The table name starts with this string.
limit – limits the number of objects returned.
from_name – enables fetching the specified number of rows following the first row whose object name matches the specified string.
deep – fetch the sub-resources columns and constraints of every table if it’s
True
. DefaultFalse
.history – includes dropped tables that have not yet been purged.
- keys() KeysView[str] ¶
- validate_table_inputs(table: Table | str, as_select: str | None = None, template: str | None = None, like_table: str | None = None, clone_table: str | Clone | None = None) None ¶
- values() ValuesView[T] ¶