Skip to main content

LangGraph integration for Hotdata runtime

Project description

hotdata-langgraph

LangGraph nodes for Hotdata — run SQL and manage databases as first-class graph nodes that read from and write to your state dict.

Install

pip install hotdata-langgraph

Authentication

Set HOTDATA_API_KEY in your environment. Optionally set HOTDATA_WORKSPACE to pin a specific workspace (the first available workspace is used if unset).

Quickstart

from langgraph.graph import StateGraph
import hotdata_langgraph as hlg

client = hlg.from_env()

builder = StateGraph(dict)
builder.add_node("run_sql", hlg.make_execute_sql_node(client=client))
builder.set_entry_point("run_sql")
builder.set_finish_point("run_sql")

graph = builder.compile()
result = graph.invoke({"sql": "SELECT * FROM orders LIMIT 10"})
print(result["result"])  # list of row dicts

SQL node

The SQL node reads a query from state, executes it on Hotdata, and writes the rows back to state.

# Factory: create a reusable node function
execute_sql = hlg.make_execute_sql_node(client=client)
builder.add_node("run_sql", execute_sql)

# State in:  {"sql": "SELECT ..."}
# State out: {"result": [{"col": val, ...}, ...]}

Managed database nodes

# Create a managed database
create_db = hlg.make_create_managed_database_node(client=client)
# State in:  {"database_name": "sales", "schema": "public", "tables": "orders,customers"}
# State out: {"database": {"id": "...", "description": "sales"}}

# Load a parquet file into a table
load_table = hlg.make_load_managed_table_node(client=client)
# State in:  {"database": "sales", "table": "orders", "file": "/path/to/orders.parquet"}
# State out: {"load_result": {"full_name": "sales.public.orders", "row_count": 1500, ...}}

Scoping queries to a managed database

Pass database= so all SQL the node runs resolves against a specific managed database:

execute_sql = hlg.make_execute_sql_node(client=client, database="sales")

Custom state keys

Override the default key names to fit your graph's state schema:

execute_sql = hlg.make_execute_sql_node(
    client=client,
    sql_key="query",    # reads from state["query"] instead of state["sql"]
    output_key="rows",  # writes to state["rows"] instead of state["result"]
)

The same *_key pattern applies to all nodes.

Run the example

uv run python examples/langgraph_basic.py

Development

uv sync --locked
uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hotdata_langgraph-0.2.2.tar.gz (149.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hotdata_langgraph-0.2.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file hotdata_langgraph-0.2.2.tar.gz.

File metadata

  • Download URL: hotdata_langgraph-0.2.2.tar.gz
  • Upload date:
  • Size: 149.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hotdata_langgraph-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a0e93545b70a9860e831d2d269cb0b4039cc199708a14d977539df56362400b1
MD5 5cfdbc9f51955d406e4341c8d50711d6
BLAKE2b-256 3920728ef6188ee04be8b8f25d5631b3faf3de286f8133df851c348d840d541a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langgraph-0.2.2.tar.gz:

Publisher: publish.yml on hotdata-dev/hotdata-langgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hotdata_langgraph-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for hotdata_langgraph-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f582bcf268bc81ee8744b3edd059bd095963fdfc212bb99e6976fc69904b165
MD5 5f39aaefd442d91a2e698206180d6be7
BLAKE2b-256 31bf84ab33c7b1bcf6394d876e2aebfa88ba35984706c0c9745c7f4ac01371b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langgraph-0.2.2-py3-none-any.whl:

Publisher: publish.yml on hotdata-dev/hotdata-langgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page