Skip to main content

fsspec-db

Database tables and views as fsspec filesystems.

Build Status codecov License PyPI

Overview

fsspec-db exposes SQL databases through familiar fsspec operations:

  • ls("/") lists schemas.
  • ls("/main") lists tables and views.
  • info("/main/users/columns/id") returns column metadata.
  • cat_file("/main/users.parquet") materializes a table as bytes.
  • query("SELECT ...") returns a pyarrow.Table.
  • open("/main/users.arrow", "wb") or put_file(..., "/main/users.parquet") inserts rows.

Native backends are registered as db+sqlite, db+postgresql / db+postgres, and db+mysql. Python adapters provide db+duckdb, db+sqlalchemy, and db+odbc.

[!WARNING] Database overwrite writes replace table contents. open(path, "wb"), pipe_file, and default put_file run truncate semantics before inserting incoming rows. Use "ab" or mode="append" to append instead.

Install

pip install fsspec-db

Quick Start

import fsspec
import pyarrow as pa
import pyarrow.ipc as ipc

fs = fsspec.filesystem("db+sqlite", database="app.db")

print(fs.ls("/", detail=False))
print(fs.ls("/main", detail=False))
print(fs.info("/main/users"))

table = fs.query("SELECT id, name FROM users WHERE id > ?", [0])

with fs.open("/main/users.arrow", "ab") as file:
    sink = pa.BufferOutputStream()
    with ipc.new_stream(sink, pa.table({"name": ["ada"]}).schema) as writer:
        writer.write_table(pa.table({"name": ["ada"]}))
    file.write(sink.getvalue().to_pybytes())

Path Shape

/main
/main/users
/main/users/columns/id
/main/users/indexes/idx_users_name
/main/users.arrow
/main/users.parquet
/main/active_users/definition.sql

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsspec_db-0.3.2.tar.gz (7.4 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fsspec_db-0.3.2-cp310-abi3-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.10+Windows x86-64

fsspec_db-0.3.2-cp310-abi3-manylinux_2_28_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

fsspec_db-0.3.2-cp310-abi3-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file fsspec_db-0.3.2.tar.gz.

File metadata

  • Download URL: fsspec_db-0.3.2.tar.gz
  • Upload date:
  • Size: 7.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fsspec_db-0.3.2.tar.gz
Algorithm Hash digest
SHA256 bdff4710e855b07d1edd53cdd4ab05ae1e58c8ae8453ecdfcc2888d04963e505
MD5 8d5c90f0c707b6c63daf32217de63d3e
BLAKE2b-256 ffe8157c7ce2380fb9b1c5652adc601edd284463e4b00a2f2b9a8d54c8fcfe40

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: fsspec_db-0.3.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fsspec_db-0.3.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8384c4c93afb44ceb206ff5c38679033bb72de6b5ea8a70c1f30546134e0919d
MD5 85bd55c9e93498eea6a667c94b391d77
BLAKE2b-256 413121ff7794d6b9e4389f9a1cad55bdc771468b8ede8c8efd027e37bb76b034

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fsspec_db-0.3.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 31b694fe0c6c6de79ff42650da1c244316d4aa49435405bb1c4a0772a0a94eed
MD5 ecbfa65684b0212e103681bfd0169e6d
BLAKE2b-256 47f89b54a0ea6e3bbddfbe3fd3a059ed03e00d54144f315073b00c643833df92

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fsspec_db-0.3.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d240e8588665b99f1d58d748dd8baba64fb02a8c65a625985d84a20a6706a66
MD5 237c0bccaded93f01c1e3bdc07d67069
BLAKE2b-256 97467c069e4eaef79a7dc546feb2220876492e81073c4a47040839c4e16aff6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page