Skip to content

Snowflake

Installation

pip install "toolfront[snowflake]"

Connection URL

Connect to Snowflake by passing a connection URL to the Database constructor:

1
2
3
4
5
from toolfront import Database

db = Database(url="snowflake://{user}:{password}@{account}/{database}")

revenue = db.ask("What's our total revenue this month?")

Connection Parameters

Alternatively, connect using the Database.from_snowflake() method with parameters:

from toolfront import Database 

db = Database.from_snowflake(
    user="user",
    account="account-id", 
    database="sales",
    password="pass",
    authenticator="snowflake"
)

revenue = db.ask("What's our total revenue this month?")
PARAMETER DESCRIPTION
user

Username

TYPE: str

account

A Snowflake organization ID and a Snowflake user ID, separated by a hyphen. Note that a Snowflake user ID is a separate identifier from a username. See https://docs.snowflake.com/en/user-guide/admin-account-identifier for details

TYPE: str

database

A Snowflake database and a Snowflake schema, separated by a /. See https://docs.snowflake.com/en/sql-reference/ddl-database for details

TYPE: str

password

Password. If empty or None then authenticator must be passed.

TYPE: str DEFAULT: None

authenticator

String indicating authentication method. See https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#connecting-with-oauth for details. Note that the authentication flow will not take place until a database connection is made. This means that connection can succeed, while subsequent API calls fail if the authentication fails for any reason.

TYPE: str DEFAULT: None

create_object_udfs

Enable object UDF extensions defined on the first connection to the database. Default is True.

TYPE: bool DEFAULT: True

match_schema

Regex pattern to filter schemas. Mutually exclusive with match_tables.

TYPE: str DEFAULT: None

match_tables

Regex pattern to filter tables. Mutually exclusive with match_schema.

TYPE: str DEFAULT: None

**kwargs

Additional arguments passed to the DBAPI connection call.

TYPE: Any DEFAULT: {}