Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

torch-sql

torch-sql is a skunkworks prototype that runs PyTorch programs, or parts of them, as SQL on XQL, a group of database projects for scientific arrays. It has three frontends:

  • a co-processor, which leaves the model in PyTorch and takes over the training data pipeline and evaluation;
  • a device, device="sql", on which every tensor is a table;
  • a torch.compile backend.

Its first real model is Samudra, an ocean emulator.

The first milestone, M1 in the design, is under way: a two-layer MLP, then nanoGPT (Andrej Karpathy's small GPT), trained on device="sql". Start with the docs:

Install

torch-sql is on PyPI, as an alpha. Install it with an engine, DuckDB or DataFusion, to run anything:

pip install "torch-sql[duckdb]"       # or torch-sql[datafusion], or both

It needs Python 3.12 or later and PyTorch 2.15 or later.

Development

torch-sql uses uv. From the repository root:

uv sync --all-extras   # PyTorch (CPU), ddxdb, DataFusion and DuckDB
uv run pytest          # every test runs on both engines
uv run ruff check && uv run ruff format --check

On NixOS, first put libstdc++ and zlib on LD_LIBRARY_PATH, as the XQL repositories' flake.nix files do.

Example

nanoGPT's model.py, unchanged, trains on device="sql" and matches PyTorch step by step (tests/test_nanogpt.py). A smaller example, a two-layer MLP run on DuckDB:

import torch, torch_sql

with torch_sql.Environment("duckdb"):
    mlp = torch.nn.Sequential(torch.nn.Linear(3, 5), torch.nn.Tanh(), torch.nn.Linear(5, 2))
    mlp = mlp.double().to("sql")
    y = mlp(torch.randn(4, 3, dtype=torch.float64, device="sql"))
    print(y)  # runs one SQL query on DuckDB

Metadata

Release files for torch-sql 0.1.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-sql 0.1.0rc2
File Size Uploaded Provenance Actions
torch_sql-0.1.0rc2.tar.gz 257.2 kB With provenance Details for torch_sql-0.1.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torch-sql 0.1.0rc2
File Interpreter ABI Platform Actions
torch_sql-0.1.0rc2-py3-none-any.whl Python 3 none any Details for torch_sql-0.1.0rc2-py3-none-any.whl

Total release size: 326.2 kB

Release files / torch_sql-0.1.0rc2.tar.gz

Download URL torch_sql-0.1.0rc2.tar.gz
Size 257.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c3cce6e9484a7e9cdc6bd99de132eea0b3b0daca786897d4187993069724fd5c
BLAKE2b-256 checksum
How to use checksums
98bf7fd8ea374c55ec9adbbe73eee332e23ee33c488830d453faf91d0c669e7e
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 Nov 16, 2026.

Transparency log

Release files / torch_sql-0.1.0rc2-py3-none-any.whl

Download URL torch_sql-0.1.0rc2-py3-none-any.whl
Size 69.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fec6ae0e4d6fe49336bd0da3fde68e5169f65ed8359ca44fa236455fde7132f
BLAKE2b-256 checksum
How to use checksums
afb77e183131987d985443a3d6a294d60fc4aacb74565fe4d543bf47e61c6e80
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 Nov 16, 2026.

Transparency log

Security for torch-sql 0.1.0rc2

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.

Select from 2 files

Attestation for torch_sql-0.1.0rc2.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 Nov 16, 2026.

Transparency log

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