Skip to content

Commit 6dee2c3

Browse files
authored
Merge pull request #19 from hotdata-dev/deps/hotdata-sdk-0.2.4
deps: upgrade hotdata SDK to 0.2.4
2 parents 2eecdd3 + ea3ca2d commit 6dee2c3

6 files changed

Lines changed: 22 additions & 22 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ classifiers = [
2424
]
2525
dependencies = [
2626
"ibis-framework>=10.0,<11",
27-
"hotdata>=0.2.3",
27+
"hotdata>=0.2.4",
2828
"pyarrow>=15",
2929
"pyarrow-hotfix>=0.6",
3030
"pandas>=2",

src/ibis_hotdata/backend.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def _resolve_connection(self, name_or_id: str) -> dict[str, Any]:
337337
raise com.IbisError(f"Unknown Hotdata connection {name_or_id!r}")
338338

339339
def _find_managed_connection(self, name_or_id: str) -> dict[str, Any] | None:
340-
"""Look up a managed database by id or description.
340+
"""Look up a managed database by id or name.
341341
342342
Returns the detail dict if found, ``None`` if not found.
343343
Raises :class:`~ibis.common.exceptions.IbisError` on API failures.
@@ -347,21 +347,21 @@ def _find_managed_connection(self, name_or_id: str) -> dict[str, Any] | None:
347347
except HotdataAPIError as exc:
348348
if exc.status_code != 404:
349349
raise _ibis_err_from_hotdata(exc) from exc
350-
# Fall back to description scan
350+
# Fall back to name scan
351351
try:
352352
data = self._http.list_databases()
353353
except HotdataAPIError as exc:
354354
raise _ibis_err_from_hotdata(exc) from exc
355355
for db in data.get("databases", []):
356-
if db.get("description") == name_or_id:
356+
if db.get("name") == name_or_id:
357357
try:
358358
return self._http.get_database(db["id"])
359359
except HotdataAPIError as exc:
360360
raise _ibis_err_from_hotdata(exc) from exc
361361
return None
362362

363363
def _resolve_managed_connection(self, name_or_id: str) -> dict[str, Any]:
364-
"""Resolve a managed database by id or description, returning its detail dict."""
364+
"""Resolve a managed database by id or name, returning its detail dict."""
365365
result = self._find_managed_connection(name_or_id)
366366
if result is None:
367367
raise com.IbisError(f"Unknown managed database {name_or_id!r}")
@@ -585,7 +585,7 @@ def create_database(
585585
raise com.UnsupportedOperationError(
586586
"Hotdata create_database creates a managed connection (catalog); catalog= is not supported"
587587
)
588-
# Check if a database with this description already exists.
588+
# Check if a database with this name already exists.
589589
# Use _find_managed_connection so API errors (5xx) propagate while
590590
# a plain not-found returns None and is handled below.
591591
existing = self._find_managed_connection(name)
@@ -594,7 +594,7 @@ def create_database(
594594
raise com.IbisInputError(f"Managed database {name!r} already exists")
595595
return
596596
try:
597-
self._http.create_managed_database(description=name, schema=schema, tables=list(tables or ()))
597+
self._http.create_managed_database(name=name, schema=schema, tables=list(tables or ()))
598598
except HotdataAPIError as exc:
599599
raise _ibis_err_from_hotdata(exc) from exc
600600

src/ibis_hotdata/http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def get_database(self, database_id: str) -> dict[str, Any]:
195195

196196
def create_managed_database(
197197
self,
198-
description: str | None = None,
198+
name: str | None = None,
199199
*,
200200
schema: str = "public",
201201
tables: Sequence[str] = (),
@@ -209,7 +209,7 @@ def create_managed_database(
209209
tables=[DatabaseDefaultTableDecl(name=t) for t in tables],
210210
)
211211
]
212-
req = CreateDatabaseRequest(description=description, schemas=schemas)
212+
req = CreateDatabaseRequest(name=name, schemas=schemas)
213213
resp = self._safe_call(self._databases.create_database, req)
214214
return resp.model_dump(by_alias=True, mode="json")
215215

tests/test_hotdata_backend.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def managed_databases_response() -> dict:
4848
"databases": [
4949
{
5050
"id": MANAGED_DB_ID,
51-
"description": MANAGED_NAME,
51+
"name": MANAGED_NAME,
5252
}
5353
]
5454
}
@@ -57,7 +57,7 @@ def managed_databases_response() -> dict:
5757
def managed_database_detail_response() -> dict:
5858
return {
5959
"id": MANAGED_DB_ID,
60-
"description": MANAGED_NAME,
60+
"name": MANAGED_NAME,
6161
"default_connection_id": MANAGED_CONN,
6262
"expires_at": None,
6363
"attachments": [],
@@ -483,14 +483,14 @@ def test_create_database_posts_managed_connection(httpserver: HTTPServer, srv: s
483483
def on_create(req: Request) -> Response:
484484
body = req.get_json()
485485
assert body == {
486-
"description": "sales",
486+
"name": "sales",
487487
"schemas": [{"name": "public", "tables": [{"name": "orders"}]}],
488488
}
489489
return Response(
490490
json.dumps(
491491
{
492492
"id": MANAGED_DB_ID,
493-
"description": "sales",
493+
"name": "sales",
494494
"default_connection_id": MANAGED_CONN,
495495
"expires_at": None,
496496
}
@@ -513,13 +513,13 @@ def on_create(req: Request) -> Response:
513513
def test_create_database_sends_no_schemas_when_no_tables(httpserver: HTTPServer, srv: str):
514514
def on_create(req: Request) -> Response:
515515
body = req.get_json()
516-
assert body.get("description") == "empty_db"
516+
assert body.get("name") == "empty_db"
517517
assert not body.get("schemas") # no tables → no schemas declared
518518
return Response(
519519
json.dumps(
520520
{
521521
"id": MANAGED_DB_ID,
522-
"description": "empty_db",
522+
"name": "empty_db",
523523
"default_connection_id": MANAGED_CONN,
524524
"expires_at": None,
525525
}

tests/test_hotdata_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ def test_create_managed_database(httpserver: HTTPServer):
222222
def on_create(req: Request) -> Response:
223223
body = req.get_json()
224224
assert body == {
225-
"description": "sales",
225+
"name": "sales",
226226
"schemas": [{"name": "public", "tables": [{"name": "orders"}]}],
227227
}
228228
return Response(
229229
json.dumps(
230230
{
231231
"id": "db_sales",
232-
"description": "sales",
232+
"name": "sales",
233233
"default_connection_id": "conn_sales",
234234
"expires_at": None,
235235
}

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)