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.1.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.1-cp311-abi3-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.11+Windows x86-64

fsspec_db-0.3.1-cp311-abi3-manylinux_2_28_x86_64.whl (7.3 MB view details)

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

fsspec_db-0.3.1-cp311-abi3-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fsspec_db-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 6ee21ae417606a685aa3dbc2ce3ca24eed44eced37891f0628dcfab92b5bf26e
MD5 e221d5e20343a0712f0c72f87e35443a
BLAKE2b-256 b642be9e40066f62802634c809a5a98caf7ad2d48453bea2d67e9a3f03813619

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: fsspec_db-0.3.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.11+, 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.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2fb938fe701e188fe874e8826b6317d07e22039e0842c0bea3ec233c849524b4
MD5 6ea98498227a50591024a997f2b0e597
BLAKE2b-256 f085cb5220fd14467e2d9faeb4d1db64348e54705584c3b610506deb851c5097

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.1-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fsspec_db-0.3.1-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f43392159c470088f918f61b8f29aa09cfcce25828eca6e66f1df4b2038893dd
MD5 2b5954365591ca70106f01d2344700b1
BLAKE2b-256 e2d986d8cd08b5b33a9fb625b974843a8da2e3fc49c8d5314ef85a86c78a713d

See more details on using hashes here.

File details

Details for the file fsspec_db-0.3.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fsspec_db-0.3.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 105ad05b2a5aadde17d3c84d22c62c3543174135ab223268744becdc17dde554
MD5 0710340bd5043316c174d01d590be177
BLAKE2b-256 aa52a96d072748554715d94982f52cf1b1266593b2b10f50c0c4b2fb29b4dc0a

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