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.1.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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hotdata_langgraph-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d6253c731f652b1ee8239288e0eb85132cf2986d6e232f2c2d8bee012055eb86
MD5 9ef652e7e3322ad0ca9c4cb590672752
BLAKE2b-256 d39b6b635a2107b7932b1a894848e69562d66888b8f0649af932d2581c8ec2d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langgraph-0.2.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hotdata_langgraph-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17e91d5abfbee784420575f4704ae6d04053a46bbd412f48b498be90c5eca7bb
MD5 0085a39707756f6b0bfa8fd69c5a0683
BLAKE2b-256 79a52f21b41c2b610e130754fbf9e512c9450796c891f5ae439493cc46f2efaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hotdata_langgraph-0.2.1-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