Registry / database / snowflake-core

snowflake-core

JSON →
library1.13.1pypypi✓ verified 24d ago

The `snowflake-core` library is a Python API that provides programmatic access to Snowflake entity metadata and allows for interaction with Snowflake resources. It enables users to create, delete, and modify Snowflake objects using Python, offering similar functionality to Snowflake's SQL command API. The library is currently at version 1.12.0 and is actively maintained with regular releases.

pip install snowflake-core
INSTALL
IMPORT
SIG · SNOWFLAKE-CORE
S
snowflake-core
databasepythonv1.13.1
Install
9.8s avg
Import
9644ms
Disk
129MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.13.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 9.8s · import 9.644s · 129MB
129MB installed
● package 129MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Root
from snowflake.core import Root
The primary entry point for managing Snowflake objects.
connect
from snowflake.connector import connect
Used to create a SnowflakeConnection object for initializing Root.
Session
from snowflake.snowpark import Session
Used to create a Snowpark Session object for initializing Root.

This quickstart demonstrates how to initialize the `Root` object, which is the entry point for managing Snowflake resources, using either a `snowflake.connector.connect` object or a `snowflake.snowpark.Session` object. It highlights the use of environment variables for secure connection parameter management.

import os from snowflake.connector import connect from snowflake.snowpark import Session from snowflake.core import Root # Option 1: Create Root instance from Snowflake Connection connection_params = { "account": os.environ.get("SNOWFLAKE_ACCOUNT", ""), "user": os.environ.get("SNOWFLAKE_USER", ""), "password": os.environ.get("SNOWFLAKE_PASSWORD", ""), "database": os.environ.get("SNOWFLAKE_DATABASE", "test_db"), "warehouse": os.environ.get("SNOWFLAKE_WAREHOUSE", "test_wh"), "schema": os.environ.get("SNOWFLAKE_SCHEMA", "public"), } # Ensure required environment variables are set if not all(connection_params.values()): print("Warning: Some Snowflake connection parameters are missing. Please set SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, and SNOWFLAKE_PASSWORD environment variables.") # Exit or handle error if connection is critical try: # Using snowflake.connector connection = connect(**connection_params) root_from_conn = Root(connection) print(f"Root instance created from SnowflakeConnection: {root_from_conn}") # Example: Accessing a database collection # Assuming 'mydatabase' exists or will be created # my_database = root_from_conn.databases["MYDATABASE"] # print(f"Accessed database: {my_database}") connection.close() # Option 2: Create Root instance from Snowpark Session # Ensure required environment variables are set for Snowpark as well if different session = Session.builder.configs(connection_params).create() root_from_session = Root(session) print(f"Root instance created from Snowpark Session: {root_from_session}") # Example: Accessing a compute pool collection # compute_pools = root_from_session.compute_pools # print(f"Accessed compute pools collection: {compute_pools}") session.close() except Exception as e: print(f"An error occurred during quickstart: {e}")
Debug
Known issues
gotchaAlways verify you are consulting the documentation for the latest version of `snowflake-core`. Snowflake's documentation portal might default to older versions, which can lead to confusion regarding available features or API signatures.
fix
Look for a 'View latest version' link or ensure the URL reflects the current version (e.g., `https://docs.snowflake.com/en/developer-guide/python-apis/` and check the version displayed on the page).
affects: <=1.12.0
gotchaUnderstand the distinction between local Python objects (references) and actual Snowflake snapshots. Operations that modify or retrieve information from Snowflake generally require explicit calls through the `Root` object and its collections, as Python objects in memory don't automatically sync with the remote state.
fix
Consult the official documentation on 'Local references vs Snowflake snapshots' to grasp the interaction model and manage performance and cost expectations.
affects: All
gotchaConnection parameters are typically sensitive and should be managed securely, preferably using environment variables as shown in official examples. Hardcoding credentials directly in code is discouraged.
fix
Store Snowflake account, user, password, and other connection details in environment variables (e.g., `SNOWFLAKE_ACCOUNT`, `SNOWFLAKE_USER`, `SNOWFLAKE_PASSWORD`) and retrieve them using `os.environ.get()`.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'snowflake.core'
The 'snowflake-core' library is not installed in the current Python environment.
fix
pip install snowflake-core
snowflake.connector.errors.ProgrammingError: Failed to connect to DB: Invalid username or password.
The provided connection parameters (username, password, account, etc.) are incorrect or incomplete when establishing the Snowflake session.
fix
Double-check all connection parameters in the `configs` dictionary or ensure environment variables (e.g., `SNOWFLAKE_ACCOUNT`, `SNOWFLAKE_USER`, `SNOWFLAKE_PASSWORD`) are correctly set.
AttributeError: 'Session' object has no attribute 'execute'
The `snowflake-core` `Session` object uses the `.sql()` method to run SQL queries, not a direct `.execute()` method like `snowflake-connector-python`'s cursor.
fix
Use `session.sql("YOUR_SQL_QUERY").collect()` or `session.sql("YOUR_SQL_QUERY").to_dataframe()` to execute SQL.
snowflake.connector.errors.ProgrammingError: SQL compilation error: Role 'MY_ROLE' does not have sufficient privileges to perform operation 'CREATE TABLE' on schema 'MY_DB.MY_SCHEMA'.
The Snowflake role associated with the current session lacks the necessary privileges to perform the requested DDL/DML operation.
fix
Grant the required privileges to the role in Snowflake using SQL, for example: `GRANT CREATE TABLE ON SCHEMA MY_DB.MY_SCHEMA TO ROLE MY_ROLE;`
Upgrade
Version history
1.13.1latest on PyPI · released Aug 12, 2026
Audit
Dependencies
PythonrequiredRequires Python 3.10 or newer.
snowflake-connector-pythonoptionalRequired for establishing a connection to Snowflake if not using Snowpark.
snowflake-snowpark-pythonoptionalRequired for establishing a Snowpark session to Snowflake if not using snowflake-connector-python.
Agent activity
44 hits · last 30 days
node
34
Meta
2
OpenAI (training)
1
Resources
snowflake-core — pip install snowflake-core · libregistry