snowflake.core.view.ViewCollection¶
- class snowflake.core.view.ViewCollection(schema: SchemaResource)¶
- Bases: - ViewCollectionBase- Represents the collection operations on the Snowflake View resource. - With this collection, you can create, iterate through, and search for views that you have access to in the current context. - Examples - Creating a view instance: - >>> views = root.databases["my_db"].schemas["my_schema"].views >>> new_view = View( ... name="my_view", ... columns=[ViewColumn(name="col1"), ViewColumn(name="col2"), ViewColumn(name="col3")], ... query="SELECT * FROM my_table", ... ) >>> views.create(new_view) - Attributes - database¶
- The DatabaseResource this collection belongs to. 
 - root¶
- The Root object this collection belongs to. 
 - Methods - create(view: View, mode: CreateMode | str | None = None, copy_grants: bool | None = None) ViewResource¶
- Create a view. - Parameters:
- view (View) – (required) 
- mode (Union[CreateMode, str]) – 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. 
- copy_grants (bool) – Parameter to enable copy grants when creating the object. 
 
 
 - create_async(view: View, mode: CreateMode | str | None = None, copy_grants: bool | None = None) PollingOperation[ViewResource]¶
- An asynchronous version of - create().- Refer to - PollingOperationfor more information on asynchronous execution and the return type.
 - items() ItemsView[str, T]¶
 - iter(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None, from_name: str | None = None, deep: bool | None = None, show_limit: int | None = None) Iterator[View]¶
- List views. - Parameters:
- like (str) – Parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters. 
- starts_with (str) – 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. 
- limit (int) – Parameter to limit the maximum number of rows returned by a command. 
- from_name (str) – 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. 
- deep (bool) – Optionally includes dependency information of the view. 
 
 
 - iter_async(*, like: str | None = None, starts_with: str | None = None, limit: int | None = None, from_name: str | None = None, deep: bool | None = None, show_limit: int | None = None) PollingOperation[Iterator[View]]¶
- 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]¶