Skip to main content

🐍 UltSQL for Python Developers

Universal Embedded & Client SDK for UltSQL

UltSQL provides a fast, multi-model database engine (Relational SQL, JSON Document store, KV caching, Vector HNSW embeddings) for Python applications.


🏛 Architecture

Understanding the client-runtime architecture:

Python Application
        ↓
UltSQL Python SDK (client package)
        ↓  (HTTP / REST JSON)
local UltSQL server process (strictly 127.0.0.1)
        ↓
Database File (*.ultsql)

The Python package ultsql is a Client SDK. The compiled native binary is the Server Runtime.

UltSQL supports two operating modes:

  1. Embedded / Local Mode: The SDK manages a local engine helper process running on 127.0.0.1 when auto_start=True or UltSQL.open() is used.
  2. Client Mode: Connects directly to an already-running local or remote UltSQL server (auto_start=False).

🚀 Quickstart Guide

1. Installation

pip install ultsql

pip downloads the prebuilt native wheel with the engine runtime for your platform (win_amd64, manylinux_2_28_x86_64, manylinux_2_28_aarch64, macosx_11_0_x86_64, macosx_11_0_arm64). Zero Dart or external dependencies required.


2. Usage Modes

Mode 1: Convenient Local Mode (Opt-in auto_start=True)

In this mode, UltSQL starts a local helper engine on loopback (127.0.0.1), assigns a random available port (or specified port), and terminates cleanly when the application exits.

import ultsql

# Convenient local mode launcher
db = ultsql.open("./app.ultsql", auto_start=True)

# Or via UltSQLClient with full configuration:
# db = ultsql.UltSQLClient("./app.ultsql", auto_start=True, host="127.0.0.1", port=0)

# Check status
print(db.status())
# Output: {'status': 'online', 'host': '127.0.0.1', 'port': 54321, 'pid': 1234, ...}

# 1. Execute SQL DDL / Queries
db.sql("""
    CREATE TABLE users (
        id INT PRIMARY KEY,
        name TEXT,
        score DOUBLE
    );
""")

# 2. Insert records
db.insert("users", {"id": 1, "name": "Alice", "score": 98.5})

# 3. High-throughput batch insert
db.insert_batch("users", [
    {"id": 2, "name": "Bob", "score": 91.2},
    {"id": 3, "name": "Charlie", "score": 87.0},
])

# 4. Query table records
users = db.query("users")
print("User rows:", users["rows"])

# 5. Clean close (also handled automatically on exit via atexit)
db.close()

Using Context Managers:

with ultsql.open("./app.ultsql") as db:
    db.sql("SELECT 1;")

Mode 2: Client Mode (Connecting to an Existing Server)

When connecting to an already-running local or remote server, pass the URL (auto_start=False by default):

from ultsql import UltSQLClient

# Connect to local dev server or remote instance
client = UltSQLClient("http://127.0.0.1:8080")

users = client.query("users")
print(users)

🛠 Running the Server Explicitly via CLI

Advanced users can launch the server runtime explicitly from the terminal:

# Development server (defaults to 127.0.0.1:8080 with live logs)
ultsql dev --db ./app.ultsql

# Or standard production server daemon
ultsql serve --host 127.0.0.1 --port 8080 --db ./app.ultsql

🔒 Security & Lifecycle Guarantees

  • Loopback Binding: Local engine servers bind exclusively to 127.0.0.1, never 0.0.0.0.
  • Port Conflict Safe: Defaults to dynamic port allocation (port=0) to avoid conflicts.
  • Process Reuse: Multiple client instances accessing the same database file share a single engine process instead of spawning redundant servers.
  • Explicit Lifecycle: Complete control with db.status(), db.stop(), db.close(), and automatic cleanup upon exit.
  • Transparency: Clear startup logging: UltSQL local server started on 127.0.0.1:<port>.

🐘 PostgreSQL Wire Protocol Support

Because UltSQL also provides a native PostgreSQL wire protocol listener:

pip install psycopg2-binary
import psycopg2

conn = psycopg2.connect("host=127.0.0.1 port=5432 user=admin password=admin dbname=ultsql_db")
cur = conn.cursor()
cur.execute("SELECT * FROM users WHERE score >= %s", (90.0,))
rows = cur.fetchall()
print("Rows:", rows)

Metadata

Release files for ultsql 1.0.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ultsql 1.0.32
File Size Uploaded Provenance Actions
ultsql-1.0.32.tar.gz 3.7 MB Without provenance Details for ultsql-1.0.32.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ultsql 1.0.32
File Interpreter ABI Platform Actions
ultsql-1.0.32-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for ultsql-1.0.32-py3-none-win_amd64.whl
ultsql-1.0.32-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for ultsql-1.0.32-py3-none-manylinux_2_28_x86_64.whl
ultsql-1.0.32-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for ultsql-1.0.32-py3-none-macosx_11_0_arm64.whl

Total release size: 23.4 MB

Release files / ultsql-1.0.32.tar.gz

Download URL ultsql-1.0.32.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
b4c3eebb0a58fe93693fee2b48c53c8ea91ed1e857fa9fa90ab9496d170881db
BLAKE2b-256 checksum
How to use checksums
16265c637dcc40f7b15a969d0719b6e7d2a13af0803946bf83ce7a46c1727275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ultsql-1.0.32-py3-none-win_amd64.whl

Download URL ultsql-1.0.32-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
75c2453acbb110188a4856b4c1f00c76b5b49638556d4e64fb6cd700655c62ee
BLAKE2b-256 checksum
How to use checksums
55f79c113b2b2b3d30710f6a89a6bead1e4bf98c00915acd799a8d05726a4f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ultsql-1.0.32-py3-none-manylinux_2_28_x86_64.whl

Download URL ultsql-1.0.32-py3-none-manylinux_2_28_x86_64.whl
Size 8.0 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8d6c62a84df57d5196720a291312a94adf8d494492f9d0742b47ce6a49925b8f
BLAKE2b-256 checksum
How to use checksums
ce5594b6e328a0a2a5dfc25e44bc47c502e6301cfc774ba24b00e5d9aaf7093f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ultsql-1.0.32-py3-none-macosx_11_0_arm64.whl

Download URL ultsql-1.0.32-py3-none-macosx_11_0_arm64.whl
Size 7.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b1d514b7adfb88ad04319f68f09be356b48ac4d109ef8dc178d2b7224eb431c1
BLAKE2b-256 checksum
How to use checksums
f690e89bd37cfe829da501baac8ee6ab13fb3bb516cc1accd7c3b94fdc9d3110
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ultsql 1.0.32

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page