snowflake.core.table.TableResource

class snowflake.core.table.TableResource(name: str, collection: TableCollection)

Bases: SchemaObjectReferenceMixin[TableCollection]

Represents a reference to a Snowflake Table resource.

Attributes

database
fully_qualified_name
root
schema

Methods

__init__(name: str, collection: TableCollection) None
create_or_update(table: TableModel) None

Create or update a table.

Parameters:

table – The Table object, including the table’s properties, object parameters, columns, and constraints.

Notes

  • Not currently implemented:
    • Row access policy

    • Column masking policy

    • Search optimization

    • Tags

    • Stage file format and copy options

    • Foreign keys.

    • Rename the table.

    • If the name and table’s name don’t match, an error will be thrown.

    • Rename or drop a column.

  • New columns can only be added to the back of the column list.

delete() None

Delete the table.

fetch(*, deep: bool = False) TableModel

Fetch the details of a table.

Parameters:

deep – Columns and constraints the Table are not fetched when deep is False. Use deep=True if you want to fetch a Table object and use create_or_update to update the table later. If you use deep=False, then create_or_update() later will raise an exception. Default False.

Notes

Inline constraints will become Outofline constraints because Snowflake database doesn’t tell whether a constraint is inline or out of line from Snowflake database.

resume_recluster() None
suspend_recluster() None
swap_with(to_swap_table_name: str) None

Swap the name with another table.

undelete() None

Undelete the previously deleted table.