Skip to main content

Python client for AnamDB — the AI-native neurosymbolic database engine.

Project description

AnamDB Python SDK

Python client for AnamDB — the AI-native neurosymbolic database engine.

Installation

pip install anamdb

For Arrow IPC support (decode query results into PyArrow tables):

pip install anamdb[arrow]

Quick Start

import asyncio
from anamdb import AnamClient

async def main():
    # Connect to a running AnamDB server
    async with AnamClient("127.0.0.1:8080") as client:
        # Check server health
        health = await client.health()
        print(f"Server: {health.status} (v{health.version})")

        # Register a table
        await client.register_table("txns", "/data/transactions.lance")

        # Register a Datalog rule
        await client.register_rule("high_risk", "fraud_prob > 0.90 AND amount > 10000")

        # Run a SQL query
        result = await client.query(
            "SELECT region, COUNT(1) AS count "
            "FROM txns WHERE fraud_prob > 0.90 "
            "GROUP BY region ORDER BY count DESC"
        )

        print(f"Rows: {result.row_count}")
        if result.reasoning_tree:
            print(f"Reasoning: {result.reasoning_tree}")

asyncio.run(main())

API Reference

AnamClient(addr, *, connect_timeout=5.0, max_retries=3)

Async context manager for connecting to an AnamDB server.

Methods:

Method Description
query(sql) Execute a SQL query, returns QueryResult
register_table(name, lance_path) Register a Lance dataset as a table
register_rule(name, datalog) Register a Datalog rule
load_model(name, version, path, ...) Load an ONNX model
health() Server health check

QueryResult

Field Type Description
row_count int Number of rows returned
reasoning_tree str | None Provenance reasoning trace
anomalies list[str] Semantic anomaly descriptions
raw_response dict Full JSON response from server

ServerHealth

Field Type Description
status str "SERVING" or "NOT_SERVING"
version str AnamDB server version
table_count int Number of registered tables
model_count int Number of loaded models
rule_count int Number of Datalog rules

License

Apache License 2.0

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

anamdb-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

anamdb-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file anamdb-1.0.0.tar.gz.

File metadata

  • Download URL: anamdb-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for anamdb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 18f11c587c0a97d60de7fbe8152ae8bf05e0a26c62d134debc03ea5b7818a442
MD5 ffb3b5642ace865149a3e112d7bef595
BLAKE2b-256 396f1f16ec94efa970965a32704ae99a93d50052244295c3e74bc59117509846

See more details on using hashes here.

File details

Details for the file anamdb-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: anamdb-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for anamdb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b132eea0d2f7b7c894d0e28e68fd0191b42eba78542b502eb17db0e4705b5dd1
MD5 048bed733618297df11048614006d535
BLAKE2b-256 29a1462d4509f4fadf996dce10f515957403b49ebf7deb88248ed735f274ec60

See more details on using hashes here.

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