Skip to content

feat: LlamaIndex tools for Hotdata managed databases with database= scoping#2

Merged
eddietejeda merged 10 commits into
mainfrom
fix/execute-sql-database-scope
May 25, 2026
Merged

feat: LlamaIndex tools for Hotdata managed databases with database= scoping#2
eddietejeda merged 10 commits into
mainfrom
fix/execute-sql-database-scope

Conversation

@eddietejeda
Copy link
Copy Markdown
Contributor

@eddietejeda eddietejeda commented May 25, 2026

Summary

This PR consolidates two lines of work (previously split across #1 and this branch):

Managed database tools (was #1):

  • Adds hotdata_list_managed_databases, hotdata_create_managed_database, and hotdata_load_managed_table FunctionTool wrappers
  • Adds databases.py with helpers: list_managed_databases_json, create_managed_database, load_managed_table, managed_database_summary, load_result_summary

Database scoping fix:

  • Adds database parameter to execute_sql_json and make_hotdata_tools, passed through to client.execute_sql(sql, database=database)
  • Bumps hotdata-runtime to >=0.2.1 to pick up the X-Database-Id header fix
  • Updates ManagedDatabase constructor calls in tests to description= / default_connection_id= fields (hotdata-runtime v0.2.0 API)
  • Fixes list_managed_databases_json test assertion to check "description" key
  • Adds test_execute_sql_json_with_database test

Require the latest SDK directly alongside hotdata-runtime for clearer version alignment.
Add scripts/release.sh for version bumps, changelog updates, tagging, and
GitHub Release creation via CI. Enforce changelog checks on version PRs.
Run locked uv sync and pytest on pull requests. Validate examples/demo.ipynb
structure and optional live smoke when HOTDATA_API_KEY is set.
Avoid duplicate [Unreleased] headings and keep the preamble intact when
preparing releases. Add unit tests and harden release workflow output.
…ping

Pass database= to client.execute_sql() so queries are scoped to a
managed database via the X-Database-Id header (hotdata-runtime>=0.2.1).
Also updates ManagedDatabase constructor calls to use description= and
default_connection_id= fields introduced in hotdata-runtime v0.2.0.
Comment thread pyproject.toml Outdated
requires-python = ">=3.10"
license = { text = "MIT" }
dependencies = [
"hotdata-runtime>=0.2.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states that database= support requires hotdata-runtime >= 0.2.1, but this pin is >=0.2.0. A user resolving against this constraint can land on 0.2.0, where client.execute_sql(sql, database=...) will fail at runtime (the kwarg doesn't exist there). The uv.lock pins 0.2.1, but downstream installs use the pyproject constraint.

Bump to hotdata-runtime>=0.2.1 to match the actual minimum required for the new code path.

Suggested change
"hotdata-runtime>=0.2.0",
"hotdata-runtime>=0.2.1",

Comment thread tests/test_tools.py
"hotdata_list_managed_databases",
"hotdata_create_managed_database",
"hotdata_load_managed_table",
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: (not blocking) make_hotdata_tools gained a database= parameter, but there's no test that the bound database actually flows through hotdata_execute_sql when the tool is invoked. The existing test_execute_sql_json_with_database covers the direct function call but not the closure inside make_hotdata_tools. A one-liner asserting mock_client.execute_sql.assert_called_with("select 1", database="my_db") after make_hotdata_tools(mock_client, database="my_db") would close that gap.

Comment on lines +17 to +24
rows = [
{
"description": db.description,
"id": db.id,
"sql_prefix": f"{db.id}.{{schema}}.{{table}}",
}
for db in client.list_managed_databases()
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: (not blocking) db.description can be None for managed databases, which would emit "description": null here. managed_database_summary already falls back to db.id for this case — consider applying the same fallback so the LLM-facing JSON is consistent across both endpoints.

Comment thread scripts/check-release.py
Comment on lines +34 to +38
base = "origin/main"
for candidate in ("origin/main", "origin/master"):
if subprocess.call(["git", "rev-parse", "--verify", candidate], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0:
base = candidate
break
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: (not blocking) The initial base = "origin/main" is redundant — the loop immediately re-evaluates the same candidate as the first iteration. You can drop the initial assignment, or initialize to None and raise SystemExit(...) if neither remote exists (instead of silently falling through to a non-existent ref and triggering the "skip" branch).

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Blocking Issues

  • pyproject.toml:13hotdata-runtime>=0.2.0 doesn't actually guarantee database= support. Per the PR description, that kwarg landed in 0.2.1, so any consumer resolving to 0.2.0 will hit a TypeError when calling execute_sql_json or any hotdata_execute_sql tool. The lockfile pinning 0.2.1 only protects this repo's CI — downstream installs use the project constraint.

Action Required

  • Bump the hotdata-runtime constraint in pyproject.toml to >=0.2.1.

Nits left inline (non-blocking).

@eddietejeda eddietejeda changed the title feat: add database= parameter to execute_sql for managed database scoping feat: LlamaIndex tools for Hotdata managed databases with database= scoping May 25, 2026
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All blocking issues from the prior review are resolved (hotdata-runtime>=0.2.1 pin).

@eddietejeda eddietejeda merged commit 43938a4 into main May 25, 2026
3 checks passed
@eddietejeda eddietejeda deleted the fix/execute-sql-database-scope branch May 25, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant