scitex-db
Database utilities for scientific computing — SQLite3 + PostgreSQL with NumPy-aware storage.
Full Documentation · uv pip install scitex-db[all]
Problem and Solution
| # | Problem | Solution |
|---|---|---|
| 1 | Numeric arrays need metadata | SQLite array helpers store binary payloads with dtype, shape, compression and hash columns. |
| 2 | Connections and transactions need explicit lifecycles | Use SQLite3 with a context manager; path-based inspection and duplicate preview are separate helpers. Health limits are stated below. |
| 3 | Backend ports change contracts | Backend-specific mixins share some names, but neither a class-name swap nor a matching method proves equivalent behavior. See the mixin guide. |
Quick Start
The example creates and removes only its own temporary SQLite database. It verifies persisted rows and an array round trip without a server or repairs.
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
from scitex_db import SQLite3
with TemporaryDirectory() as directory:
path = Path(directory) / "experiments.db"
arr = np.arange(2048, dtype=np.float32).reshape(32, 64)
with SQLite3(str(path), compress_by_default=True) as db:
db.create_table("results", {
"id": "INTEGER PRIMARY KEY", "experiment": "TEXT", "accuracy": "REAL",
})
db.insert_many("results", [
{"experiment": "exp1", "accuracy": 0.95},
{"experiment": "exp2", "accuracy": 0.92},
])
rows = db.get_rows("results", where="accuracy > 0.9", order_by="id")
assert rows["experiment"].tolist() == ["exp1", "exp2"]
db.create_table("features", {"id": "INTEGER PRIMARY KEY", "embeddings": "BLOB"})
db.save_array("features", arr, column="embeddings", additional_columns={"id": 1}, verbose=False)
features = db.load_array("features", "embeddings", verbose=False)
assert features.shape == (1, 32, 64) and features.dtype == arr.dtype
assert np.array_equal(features[0], arr)
with SQLite3(str(path), mode="ro") as db:
assert db.get_rows("results", order_by="id")["id"].tolist() == [1, 2]
assert not path.exists()
Clean SQLite context exit commits; exceptions roll back and exit closes. Array loads retain a leading row dimension. See the complete quick start and array guide.
SQLite3 connections stay in their creating thread. For parallel readers, open
a separate SQLite3(path, mode="ro") inside each worker process. See the
read-only worker guide
for a tested spawn example and the distinction between SQL row selection and
loading complete array BLOBs.
Inspect an existing SQLite file
Replace the path and table with your own existing file and table. Inspection opens that SQLite file read-only; it does not create a missing database.
scitex-db inspect-db /path/to/existing.db --tables results
scitex-db inspect-db /path/to/existing.db --tables results --json
For inspection JSON, use scitex-db inspect-db experiments.db --json
or scitex-db --json inspect-db experiments.db. The output is a list of table
schemas, row counts and up to five sample rows per table; BLOB samples are
size placeholders projected in SQLite without transferring the payload into
Python. This is not a bounded-memory or chunked loader. --quiet does not
suppress JSON. Non-finite sample numbers
produce an error instead of invalid JSON. See the
CLI reference.
check-health is exported, but existing-file scans depend on an undeclared
umbrella loadability provider and may not complete in a core-only install.
The CLI reports a missing provider before scanning; this is a preflight
refusal, not a completed health result. JSON serialization for check-health
is unimplemented. Repairs are not demonstrated here; their behavior remains
unqualified. See the maintenance guide.
Installation
uv pip install "scitex-db[all]"
Per-backend extras
| Extra | Command | Adds |
|---|---|---|
| (none) | uv pip install scitex-db |
SQLite3 backend, NumPy-aware storage, CLI |
postgresql |
uv pip install "scitex-db[postgresql]" |
psycopg2-binary + sqlalchemy driver |
git |
uv pip install "scitex-db[git]" |
GitPython for the db-versioning mixin |
all |
uv pip install "scitex-db[all]" |
everything above, plus dev and docs |
Configuration
The current CLI takes database paths and options explicitly on the command
line. YAML configuration and automatic .env loading are not implemented:
./config.yaml, SCITEX_DB_CONFIG and ~/.scitex/db/config.yaml do not select
CLI defaults. Pass options such as --tables directly; malformed files at
these locations are ignored, so a successful command does not validate them.
Portable project/user configuration under .scitex/db remains an intended
contract awaiting implementation; there is no supported file precedence yet.
See the CLI skill
and .env.example. Python callers pass constructor/function
arguments explicitly; store.resolve_store(env=...) separately reads the
caller-named environment variable, not a package-wide YAML configuration.
Architecture
flowchart LR
U["User code"] --> S["SQLite3 with context manager"]
U --> P["Optional PostgreSQL class"]
S --> SM["SQLite-specific mixins"]
P --> PM["PostgreSQL-specific mixins"]
PM --> BM["Selected base mixins"]
C["inspect-db command"] --> H["Read-only SQLite inspector"]
H --> F["SQLite file"]
Figure 1. Source composition and SQLite helper routing.
SQLite's mixins do not inherit the base stubs; some PostgreSQL mixins do. Backend names, arguments, results and transaction behavior need separate qualification. This diagram does not establish backend parity or completed health/repair support. See the mixin guide.
2 Interfaces
Python API ⭐⭐⭐ primary surface
| SQLite operation | Current entry point |
|---|---|
| Connection lifecycle | with SQLite3(path) as db |
| Batch insert / row reads | db.insert_many(...) / db.get_rows(...) |
| Numeric array storage | db.save_array(...) / db.load_array(table, column, ...) |
| Explicit transactions | with db.transaction(): ... |
| Read-only path inspection | inspect(path, ...) returns table dictionaries |
| Duplicate preview | delete_sqlite3_duplicates(path, table_name, ...) defaults to preview |
These are SQLite contracts. PostgreSQL requires its optional dependencies and
native server tests; matching names such as get_rows do not imply parity.
The Python API guide and
mixin guide describe the surfaces.
Generic-object BLOB serialization is outside this numeric example's
qualification. Existing-file health/repair limits are stated above.
CLI ⭐ scitex-db <subcommand>
scitex-db --help
scitex-db skills list --json
scitex-db skills get 11_quick-start --json
The leaf skills commands expose bundled guidance; the root SKILL.md is
retrieved through the owning Dev provider rather than the leaf's sub-skill
lookup. Options and JSON support are command-specific: consult each command's
help. The inspection example above supports JSON; health JSON remains
unimplemented. A root help entry or a successful preflight does not prove that
an operation completed.
Behavioral evidence and limits
The quick-start block is a complete disposable fixture, not pseudocode.
Owning implementations are _sqlite3/_SQLite3.py, _SQLite3Mixins/_RowMixin.py,
_BatchMixin.py, _ArrayMixin.py, _inspect.py, _skills.py and __main__.py.
Existing leaf controls include tests/scitex_db/_sqlite3/test__SQLite3.py,
test__SQLite3_context_commit.py, tests/scitex_db/test___main__.py,
test__inspect_readonly.py, test__skills.py and the duplicate-preview tests.
Actual fixture/CLI results are separate from static checks, build success,
public distribution adoption, rendered diagrams or served documentation.
Array read measurements
For a reproducible resident NumPy / plain SQLite / compressed SQLite baseline, see the array-read benchmark. It measures the current whole-BLOB loader; it does not provide chunked time-series reads.
Part of SciTeX
scitex-db is part of SciTeX. The standalone
distribution provides scitex_db and the scitex-db command; see the
installation guide.
Any umbrella facade or forwarding belongs to the separately installed
umbrella distribution. Its availability and behavior are not established by
installing scitex-db or by assuming that scitex.db is the same module.
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
Metadata
Release files for scitex-db 0.2.4
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 |
|---|---|---|---|---|
| scitex_db-0.2.4.tar.gz | 8.4 MB | With provenance | Details for scitex_db-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scitex_db-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for scitex_db-0.2.4-py3-none-any.whl |
Total release size: 16.4 MB
Release files / scitex_db-0.2.4.tar.gz
| Download URL | scitex_db-0.2.4.tar.gz |
|---|---|
| Size | 8.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
942c415bfe43568c62c72874f6d4872cfd9253f50f53593c4a46b61b7f52d47a
|
|
BLAKE2b-256 checksum How to use checksums |
929af95cf4a16ecb4a6f6efa06cfb962c182ef49db0de10cb5d6f9027b56458f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logRelease files / scitex_db-0.2.4-py3-none-any.whl
| Download URL | scitex_db-0.2.4-py3-none-any.whl |
|---|---|
| Size | 8.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4afd917ffb65ad1ab074a478bd7ac29ad8fd54799ca93408b62e6976b7d10ce
|
|
BLAKE2b-256 checksum How to use checksums |
1c043bdc9f85ecb1e1533cd8cc0690f2cb9446b8e8e5f6a10e402e9c7e544560
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logSecurity for scitex-db 0.2.4
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scitex_db-0.2.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Transparency logA 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.