🐍 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:
- Embedded / Local Mode: The SDK manages a local engine helper process running on
127.0.0.1whenauto_start=TrueorUltSQL.open()is used. - 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, never0.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.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ultsql-1.0.29.tar.gz | 3.7 MB | Without provenance | Details for ultsql-1.0.29.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ultsql-1.0.29-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for ultsql-1.0.29-py3-none-win_amd64.whl |
| ultsql-1.0.29-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for ultsql-1.0.29-py3-none-manylinux_2_28_x86_64.whl |
| ultsql-1.0.29-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for ultsql-1.0.29-py3-none-macosx_11_0_arm64.whl |
Total release size: 23.2 MB
Release files / ultsql-1.0.29.tar.gz
| Download URL | ultsql-1.0.29.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adb156da9b58bd270faf943b51072ef34e8b10aff445fd6d444e09f019869049
|
|
BLAKE2b-256 checksum How to use checksums |
d09ae8f95186966f4b8de1ecf2affca93742f308e1cda5b651c6e7a3a2461540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ultsql-1.0.29-py3-none-win_amd64.whl
| Download URL | ultsql-1.0.29-py3-none-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
59a69571d57b2ee390dd10fb175634e144588c48acfc9c56723074689c351e74
|
|
BLAKE2b-256 checksum How to use checksums |
da07a035a6c9c0c8aebb91492637cd50402dd11027321d409e9f391b20505bb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ultsql-1.0.29-py3-none-manylinux_2_28_x86_64.whl
| Download URL | ultsql-1.0.29-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 |
5ca51a7febd9e6a76821728280ba353e4a9447dafcab409366e45c3383cc9780
|
|
BLAKE2b-256 checksum How to use checksums |
0347310fbae67cc3116a2d186ed7e666cc5379e0b00c170e587f2cdcb7a751c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ultsql-1.0.29-py3-none-macosx_11_0_arm64.whl
| Download URL | ultsql-1.0.29-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 |
43f22bd4e8184ee71524d693c5c204ac31d90a029b78c4f93ec388c45a6c1ef8
|
|
BLAKE2b-256 checksum How to use checksums |
e1084f18a95e886e416d1e072bf309a5cc34f07a5855ce8a04e99c26fee30500
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for ultsql 1.0.29
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.