Fuju Trace SQL adapters
This package holds the shared database implementation for three separately
installable Fuju Trace packages: fuju-trace-sqlite, fuju-trace-duckdb, and
fuju-trace-postgresql. It remains directly installable for 0.1.10 users.
The adapters have the same event ingestion
and basic read API as the VexDB adapter, but their current text search is a
portable substring scan. They do not provide BM25, ANN, vector writes, or
hybrid search. Use VexDB or the local TraceDB when those search features matter.
Install the matching backend extra:
python -m pip install 'fuju-trace[sqlite]==0.1.11'
python -m pip install 'fuju-trace[duckdb]==0.1.11'
python -m pip install 'fuju-trace[postgresql]==0.1.11'
The direct packages fuju-trace-sqlite, fuju-trace-duckdb, and fuju-trace-postgresql use this shared implementation.
Install from this checkout
python -m pip install -e ./fuju-trace-sdk/python -e ./fuju-trace-sql
# Add one or more optional drivers when needed:
python -m pip install 'duckdb>=1.0,<3' 'psycopg2-binary>=2.9.5,<3'
SQLite uses Python's standard library. The DuckDB and PostgreSQL packages
install their respective database drivers. Existing users can still install
fuju-trace-sql[duckdb]==0.1.11 or
fuju-trace-sql[postgresql]==0.1.11 directly.
Connect
from fuju_trace import DbExporter, Tracer, connect
with connect(sqlite_path="./trace.sqlite", tenant_id=1, initialize=True) as db:
tracer = Tracer(exporter=DbExporter(db, tenant_id=1), node_id=1)
with tracer.trace("request", session_id=42, tenant_id=1) as trace:
with trace.span("tool call") as span:
span.log("query failed")
tracer.close()
print(db.search(text="failed", k=10))
print(db.list_spans(filters={"externalSessionId": 42}))
Other connection forms:
connect(duckdb_path="./trace.duckdb", tenant_id=1, initialize=True)
connect(postgresql_dsn="dbname=app user=trace", tenant_id=1, initialize=True)
connect(postgresql_params={"host": "localhost", "dbname": "app",
"user": "trace"}, tenant_id=1, initialize=True)
Supply credentials from your secret manager or environment, never from source
control. Set initialize=True only for first setup; it creates private
fuju_trace_* tables and indexes. Use table_prefix to isolate installations.
Opening a database without the schema requires initialization first.
API and limits
ingest(events)is transactional and deduplicates(ext_span_id, seq, event_type)within the bound tenant. The source event and folded span are committed together.trace(id),span(trace_id, span_id),list_spans(filters=...), andlist_trace_ids(filters=...)read the folded model.search(text=..., k=..., filter=...)searches log and input/output text. Supported filters include trace ID, session ID, time, agent, status, and exact attributes.%and_in a query are treated literally.capabilities()reportstext="substring_scan"andvector=None. Passing a vector raisesNotImplementedError.- Each store binds one tenant and serializes one connection across threads.
Give each process its own connection and each writer process a distinct
node_id(0–1023). - SQLite enables WAL for file databases; concurrent writes still serialize. DuckDB is best used by one writer process for a database file. PostgreSQL uses row locks when folding spans.
- The substring search has no text index and can scan many spans. It is a correctness-first baseline, not a large-scale search benchmark result.
For DuckDB's file concurrency behavior and FTS index refresh requirement, see its concurrency and full-text search documentation.
Verification
python -m unittest discover -s fuju-trace-sql/tests -p 'test_*.py'
SQLite and DuckDB tests use real database files. They cover writes, retries, filters, tenant isolation, and reopen. The PostgreSQL test below uses a real server and covers the same path plus two connections writing one span at the same time. No MySQL server is needed or supported.
To start a temporary local PostgreSQL instance, run the following from the
repository root. It listens only on a private Unix socket and deletes its data
directory after the test. initdb, pg_ctl, createdb, and a Python with
psycopg2 must be installed:
FUJU_SQL_PYTHON=python3 ./fuju-trace-sql/tests/run_local_postgresql.sh
For an existing disposable test database with table create/drop permission,
set POSTGRESQL_DSN and run python fuju-trace-sql/tests/live_smoke.py.
The test creates and removes only four tables under its own random
fuju_smoke_* prefix. CI runs it against a PostgreSQL 16 service container.
These checks verify storage behavior; they do not benchmark search performance
or exercise VexDB-Lite vector extensions.
The real database test report
records the versions and results from the local run.
Metadata
Release files for fuju-trace-sql 0.1.11
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 |
|---|---|---|---|---|
| fuju_trace_sql-0.1.11.tar.gz | 12.4 kB | Without provenance | Details for fuju_trace_sql-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fuju_trace_sql-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for fuju_trace_sql-0.1.11-py3-none-any.whl |
Total release size: 21.6 kB
Release files / fuju_trace_sql-0.1.11.tar.gz
| Download URL | fuju_trace_sql-0.1.11.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60e734c3cb12c5d3c426c892e24b3c204690de9057fd76b5e6727bcbd7a3a1da
|
|
BLAKE2b-256 checksum How to use checksums |
1c3d9b941a73a4c5a066fe63c40580aef88aa104dc04e4b9dcb938694e26f296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / fuju_trace_sql-0.1.11-py3-none-any.whl
| Download URL | fuju_trace_sql-0.1.11-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4e7b5817e2d28fa086c22f7329feb381b431395f1961d33be9c95b7ace2394f
|
|
BLAKE2b-256 checksum How to use checksums |
6cf36dba2d0104ef6691c73295beba2a0cd6d665ea0228d17e822f7e9949585c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for fuju-trace-sql 0.1.11
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.