Skip to content
Draft
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
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies = [
"structlog>=24.4,<26",
"psycopg[binary]>=3.2,<4",
"psycopg-pool>=3.2,<4",
"databricks-zerobus-ingest-sdk>=1.10,<1.11",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -53,3 +54,8 @@ markers = ["integration: needs Redpanda, ClickHouse or Postgres running locally"
[tool.mypy]
strict = true
files = ["warehouse_delivery", "tests"]

# The Zerobus SDK ships no type information.
[[tool.mypy.overrides]]
module = "zerobus.*"
ignore_missing_imports = true
33 changes: 33 additions & 0 deletions tests/unit/test_warehouses.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from warehouse_delivery.connections import WarehouseConnection
from warehouse_delivery.warehouses import warehouse_for
from warehouse_delivery.warehouses.clickhouse import ClickHouseWarehouse
from warehouse_delivery.warehouses.databricks import DatabricksWarehouse

CONFIG = {
"host": "ch.acme-corp.example",
Expand Down Expand Up @@ -34,6 +35,38 @@ def test_warehouse_for__clickhouse_connection__builds_the_clickhouse_adapter() -
)


def test_warehouse_for__databricks_connection__builds_the_databricks_adapter() -> None:
# Given
connection = WarehouseConnection(
id=7,
warehouse_type="databricks",
config={
"host": "dbc-a1b2c3d4-e5f6.cloud.databricks.com",
"warehouse_id": "abc123",
"catalog": "main",
"schema": "flagsmith",
"workspace_id": "1234567890123456",
"region": "us-west-2",
},
credentials={"client_id": "sp-id", "client_secret": "sp-secret"},
)

# When
warehouse = warehouse_for(connection)

# Then
assert warehouse == DatabricksWarehouse(
connection_id=7,
host="dbc-a1b2c3d4-e5f6.cloud.databricks.com",
workspace_id="1234567890123456",
region="us-west-2",
catalog="main",
schema="flagsmith",
client_id="sp-id",
client_secret="sp-secret",
)


def test_warehouse_for__type_without_an_adapter__returns_none() -> None:
# Given a connection type the API accepts but nothing here delivers to yet
connection = WarehouseConnection(
Expand Down
Loading