snowflake.core.Root¶
- class snowflake.core.Root(connection: SnowflakeConnection | Session)¶
Bases:
object
The entry point of the Snowflake Core Python APIs that manage the Snowflake objects.
- Parameters:
connection – A
SnowflakeConnection
or SnowparkSession
instance.
Example
Create a Root instance:
>>> from snowflake.connector import connect >>> from snowflake.core import Root >>> from snowflake.snowpark import Session >>> CONNECTION_PARAMETERS = { ... "account": os.environ["snowflake_account_demo"], ... "user": os.environ["snowflake_user_demo"], ... "password": os.environ["snowflake_password_demo"], ... "database": test_database, ... "warehouse": test_warehouse, ... "schema": test_schema, ... } >>> # create from a Snowflake Connection >>> connection = connect(**CONNECTION_PARAMETERS) >>> root = Root(connection) >>> # or create from a Snowpark Session >>> session = Session.builder.config(CONNECTION_PARAMETERS).create() >>> root = Root(session)
Use the root instance to access resource management APIs:
>>> tasks = root.databases["mydb"].schemas["myschema"].tasks >>> mytask = tasks["mytask"] >>> mytask.resume() >>> compute_pools = root.compute_pools >>> my_computepool = compute_pools["mycomputepool"] >>> my_computepool.delete()
Attributes
- compute_pools¶
- connection¶
Return the connection in use.
This is the connection used to create this Root instance, or the Snowpark session’s connection if this root is created from a session.
- databases¶
- session¶
Returns the session that is used to create this Root instance.
Returns
None
if the root wasn’t created from a session but aSnowflakeConnection
.
- warehouses¶
Methods
- __init__(connection: SnowflakeConnection | Session) None ¶