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
andSNOWFLAKE_PASSWORD
) or via keys in the credentials dictionary (user
andpassword
).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 source_type: DataSourceType#
Returns the data source type accessible by this connector.
- 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 tablename
. To use a source table in Kumo, you will need to construct aTable
from the source table.- Parameters:
name (
str
) – The table name.- Raises:
ValueError – if
name
does not exist in the backing connector.- Return type: