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

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

Built distributions (wheels)

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

Total release size: 23.3 MB

Release files / ultsql-1.0.31.tar.gz

Download URL ultsql-1.0.31.tar.gz
Size 3.7 MB
Tags Source
SHA-256 checksum
How to use checksums
fc6d9496ed3fb957506728e34c4fec4cb9f90a8109648943d4612959f8638f73
BLAKE2b-256 checksum
How to use checksums
947a38097de4ff98773ee0fb03d347b1be6827e5cdd74b1059123face8de116f
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.31-py3-none-win_amd64.whl

Download URL ultsql-1.0.31-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
2dd693fb07b13ac6aed0b853b8c29fd9c9a977234da73852087b052067b7e601
BLAKE2b-256 checksum
How to use checksums
705f70df2381d3be3e71ee55a73068067bf67b430528e0b4547351084c5eb6c6
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.31-py3-none-manylinux_2_28_x86_64.whl

Download URL ultsql-1.0.31-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
4a582c9d62efb0f1fad19076dbb1d3a3bd25daec5d3dc509ee72ae0c56a4e9ec
BLAKE2b-256 checksum
How to use checksums
72742b8eaaf7c72f0dad1e5a4716261dcc9df8ca938c01da830fb4f6e5dda335
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.31-py3-none-macosx_11_0_arm64.whl

Download URL ultsql-1.0.31-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
396c5537caea2ef01712318c36a6405bef5794a9a04e9448e57130c5f5dab711
BLAKE2b-256 checksum
How to use checksums
917156325fea9bab91d36fd41ee9dbf906453ecb1500b0d397a194bd5c42126e
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.31

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