snowflake.core.view.ViewResource | Snowflake Documentation (original) (raw)

class snowflake.core.view.ViewResource(name: Annotated[str, Strict(strict=True)], collection: ViewCollection)

Bases: SchemaObjectReferenceMixin[ViewCollection]

Represents a reference to a Snowflake view.

With this view reference, you can drop and fetch information about views.

Attributes

database

The DatabaseResource this reference belongs to.

fully_qualified_name

Return the fully qualified name of the object this reference points to.

root

The Root object this reference belongs to.

Methods

drop(if_exists: bool | None = None) → None

Drop this view.

Parameters:

if_exists (bool , optional) – Check the existence of this view before dropping it. Default is None, which is equivalent to False.

Examples

Deleting a view using its reference:

view_reference.drop()

Deleting a view using its reference if it exists:

view_reference.drop(if_exists = True)

drop_async(if_exists: bool | None = None) → PollingOperation[None]

An asynchronous version of drop().

Refer to PollingOperation for more information on asynchronous execution and the return type.

fetch() → View

Fetch the details of a view.

Examples

Fetching a reference to a view to print its name and query properties:

my_view = view_reference.fetch() print(my_view.name, my_view.query)

fetch_async() → PollingOperation[View]

An asynchronous version of fetch().

Refer to PollingOperation for more information on asynchronous execution and the return type.