Skip to content

Address managed databases by id only, never by name (breaking) #38

Description

@rohan-hotdata

Breaking change. Address managed databases by id only, mirroring what hotdata-dlt-destination did in its PR #59 ("address managed databases by id only, never by name").

The problem

Hotdata database names are display labels, not identifiers, and are not unique. hotdata-framework's resolve_managed_database(name_or_id) tries get_database(id) first and then falls back to scanning list_databases() matching on db.name. Every database-addressing path in this repo goes through it:

Where What is passed today
make_hotdata_tools(database=...) name or id → every SQL query
hotdata_load_managed_table(database=...) agent-supplied, name or id
make_hotdata_search_tool(database=...) name or id
make_hotdata_describe_tables_tool(database=...) name or id
demo/bm25_search_demo.py passes a name

This repo is the worse case than dlt-destination was, because the value can come from an LLM. An agent calling hotdata_load_managed_table(database="analytics", ...) can write into the wrong database on a name collision — a destructive mode="replace" load.

Latent, not live: the test workspace has 8 managed databases with no duplicate labels.

Scope

  • Take database_id and resolve once via get_database(id); never scan, never match on name.
  • Keep a display label only for the create path.
  • The agent-facing hotdata_load_managed_table should require an id — one obtained from hotdata_list_managed_databases, not invented.
  • Update demo/ and examples/ to pin ids, which also models the correct workflow.
  • Partially depends on the framework side of this (hotdata-framework: client gaps blocking agent use (error opacity, create_index, id-first, workspace default) #36 item 3); the client-side change stands alone regardless.

Already done as groundwork

Tool descriptions now steer towards ids without changing behaviour — hotdata_list_managed_databases says "Names are display labels and are not unique — pass the 'id' to other tools, never the description", and the load tool's description says database should be a database id. Pinned by tests/test_descriptions.py::test_database_descriptions_steer_towards_ids.

Timing

Worth landing before the next release. There is already a stale release PR (#23) and this repo has not yet been picked up by partners, so one breaking version carrying both this and the search work beats two.

Also related: from_env() silently selects a workspace when HOTDATA_WORKSPACE is unset (#36 item 4). Same family of "implicitly addressed the wrong thing" hazard, one level up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-native-layerPart of the AI-native query layer effort for LangChainbreakingBreaking change to the public APIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions