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.30

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.30
File Size Uploaded Provenance Actions
ultsql-1.0.30.tar.gz 3.7 MB Without provenance Details for ultsql-1.0.30.tar.gz

Built distributions (wheels)

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

Total release size: 23.3 MB

Release files / ultsql-1.0.30.tar.gz

Download URL ultsql-1.0.30.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
017cd1771f8bb11292c555c520fd9123518f90352a471de8b0a08121d997f79e
BLAKE2b-256 checksum
How to use checksums
7f710cd1a67f3c9c7fbe077114ae562770f2f9f8181bed8d9313f3cae86457f7
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.30-py3-none-win_amd64.whl

Download URL ultsql-1.0.30-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
81c246dea761155ffebaa050c47845d8ac62b089be6fd650cc0256027a1e8e51
BLAKE2b-256 checksum
How to use checksums
63ec9ed58a0bb78bb3ce35b150bc208639d54915b1beaf5d3906c1ade8c07032
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.30-py3-none-manylinux_2_28_x86_64.whl

Download URL ultsql-1.0.30-py3-none-manylinux_2_28_x86_64.whl
Size 7.9 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
bb0c0a77581db8a5a675cff920c8943ad7ba81f354ff88cb0a3a8d2101604af9
BLAKE2b-256 checksum
How to use checksums
fbce16f51b7af19b6d0bcb1bb0d13aee7fadcec05f42879f744ecb961e219e1f
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.30-py3-none-macosx_11_0_arm64.whl

Download URL ultsql-1.0.30-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
56fe0ecb0a34dfa3eb5ba8b83db5f202fbf5fa74c590693836550d4d92c94bd1
BLAKE2b-256 checksum
How to use checksums
b94958d4b236f76dad7d923b8b22f509a435930987835ed06678d35c24e2f634
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.30

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