Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ibis-server/app/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,6 @@ class SnowflakeConnectionInfo(BaseConnectionInfo):
user: SecretStr = Field(
description="the username of your database", examples=["admin"]
)
password: SecretStr = Field(
description="the password of your database", examples=["password"]
)
account: SecretStr = Field(
description="the account name of your database", examples=["myaccount"]
)
Expand All @@ -299,6 +296,14 @@ class SnowflakeConnectionInfo(BaseConnectionInfo):
description="the schema name of your database",
examples=["myschema"],
) # Use `sf_schema` to avoid `schema` shadowing in BaseModel
warehouse: SecretStr = Field(
description="the warehouse name of your database", examples=["COMPUTE_WH"]
)
private_key: SecretStr | None = Field(
description="the private key for key pair authentication",
examples=["private_key_content"],
default=None,
)
kwargs: dict[str, str] | None = Field(
description="Additional arguments passed to the DBAPI connection call.",
default=None,
Expand Down
3 changes: 2 additions & 1 deletion ibis-server/app/model/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ def get_oracle_connection(info: OracleConnectionInfo) -> BaseBackend:
def get_snowflake_connection(info: SnowflakeConnectionInfo) -> BaseBackend:
return ibis.snowflake.connect(
user=info.user.get_secret_value(),
password=info.password.get_secret_value(),
account=info.account.get_secret_value(),
database=info.database.get_secret_value(),
schema=info.sf_schema.get_secret_value(),
warehouse=info.warehouse.get_secret_value(),
private_key=info.private_key.get_secret_value(),
**info.kwargs if info.kwargs else dict(),
)

Expand Down
3 changes: 2 additions & 1 deletion ibis-server/tests/routers/v2/connector/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

connection_info = {
"user": os.getenv("SNOWFLAKE_USER"),
"password": os.getenv("SNOWFLAKE_PASSWORD"),
"account": os.getenv("SNOWFLAKE_ACCOUNT"),
"database": "SNOWFLAKE_SAMPLE_DATA",
"schema": "TPCH_SF1",
"warehouse": "COMPUTE_WH",
"private_key": os.getenv("SNOWFLAKE_PRIVATE_KEY"),
}

manifest = {
Expand Down
3 changes: 2 additions & 1 deletion ibis-server/tests/routers/v3/connector/snowflake/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def pytest_collection_modifyitems(items):
def connection_info() -> dict[str, str]:
return {
"user": os.getenv("SNOWFLAKE_USER"),
"password": os.getenv("SNOWFLAKE_PASSWORD"),
"account": os.getenv("SNOWFLAKE_ACCOUNT"),
"database": "SNOWFLAKE_SAMPLE_DATA",
"schema": "TPCH_SF1",
"warehouse": "COMPUTE_WH",
"private_key": os.getenv("SNOWFLAKE_PRIVATE_KEY"),
}