kumoai.connector.SnowflakeConnector#

class kumoai.connector.SnowflakeConnector[source]#

Bases: Connector

Establishes a connection to a Snowflake database.

Multiple methods of authentication are available. Username/password authentication is supported either via environment variables (SNOWFLAKE_USER and SNOWFLAKE_PASSWORD) or via keys in the credentials dictionary (user and password).

Note

Key-pair authentication is coming soon; please contact your Kumo POC if you need access.

import kumoai

# Either pass `credentials=dict(user=..., password=...)` or set the
# 'SNOWFLAKE_USER' and 'SNOWFLAKE_PASSWORD' environment variables:
connector = kumoai.SnowflakeConnector(
    name="<connector_name>",
    account="<snowflake_account_name>",
    database="<snowflake_database_name>"
    schema_name="<snowflake_schema_name>",
    credentials=credentials,
)

# List all tables:
print(connector.table_names())

# Check whether a table is present:
assert "articles" in connector

# Fetch a source table (both approaches are equivalent):
source_table = connector["articles"]
source_table = connector.table("articles")
Parameters:
  • name (str) – The name of the connector.

  • account (str) – The account name.

  • warehouse (str) – The name of the warehouse.

  • database (str) – The name of the database.

  • schema_name (str) – The name of the schema.

  • credentials (Optional[Dict[str, str]]) – The username and password corresponding to this Snowflake account, if not provided as environment variables.

__init__(name, account, warehouse, database, schema_name, credentials=None, _bypass_creation=False)[source]#
classmethod get_by_name(name)[source]#

Returns an instance of a named Snowflake Connector, including those created in the Kumo UI.

Parameters:

name (str) – The name of the existing connector.

Return type:

Self

Example

>>> import kumoai
>>> connector = kumoai.SnowflakeConnector.get_by_name("name")  
property name: str#

Returns the name of this connector.

property source_type: DataSourceType#

Returns the data source type accessible by this connector.

has_table(name)#

Returns True if the table exists in this connector, False otherwise.

Parameters:

name (str) – The table name.

Return type:

bool

table(name)#

Returns a SourceTable object corresponding to a source table behind this connector. A source table is a view into the raw data of table name. To use a source table in Kumo, you will need to construct a Table from the source table.

Parameters:

name (str) – The table name.

Raises:

ValueError – if name does not exist in the backing connector.

Return type:

SourceTable

table_names()#

Returns a list of table names accessible through this connector.

Return type:

List[str]