Skip to main content

SQLAlchemy dialect for Excel files — use Excel as a database

Project description

sqlalchemy-excel

SQLAlchemy dialect for Excel files — use Excel as a database.

from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import DeclarativeBase, Session, Mapped, mapped_column

engine = create_engine("excel:///data.xlsx")

class Base(DeclarativeBase):
    pass

class User(Base):
    __tablename__ = "Sheet1"
    id: Mapped[int] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column()

Base.metadata.create_all(engine)

with Session(engine) as session:
    session.add(User(id=1, name="Alice"))
    session.commit()

with Session(engine) as session:
    users = session.query(User).all()

Installation

pip install sqlalchemy-excel

URL Format

# Relative path
engine = create_engine("excel:///data.xlsx")

# Absolute path (note four slashes)
engine = create_engine("excel:////home/user/data.xlsx")

Features

  • Full SQLAlchemy 2.0 dialect
  • PEP 249 DB-API 2.0 compliant driver (excel-dbapi)
  • SELECT with WHERE, ORDER BY, LIMIT
  • INSERT, UPDATE, DELETE
  • CREATE TABLE / DROP TABLE
  • ORM support with DeclarativeBase
  • Type mapping: String, Integer, Float, Boolean, Date, DateTime

Limitations

  • No JOIN, GROUP BY, HAVING, DISTINCT, OFFSET
  • No subqueries, CTEs, or aggregate functions
  • No ALTER TABLE, foreign keys, or indexes
  • Single-table operations only

License

MIT

Project details


Download files

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

Source Distribution

sqlalchemy_excel-0.1.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

sqlalchemy_excel-0.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_excel-0.1.1.tar.gz.

File metadata

  • Download URL: sqlalchemy_excel-0.1.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sqlalchemy_excel-0.1.1.tar.gz
Algorithm Hash digest
SHA256 81de0a5073527d41cc363959d906f05ed13bb5d7e5d54390e324e73a1679722a
MD5 d373cf1c8f56fdea500ed6a0cfc3d01b
BLAKE2b-256 d1b58550b7bea8605e116162d1b3987406855453059324cabc7bf849a361094f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_excel-0.1.1.tar.gz:

Publisher: publish-pypi.yml on yeongseon/sqlalchemy-excel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqlalchemy_excel-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_excel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa80ccb3426fb7c69f8076850f95b0cfdb593dd71ba94bb82c216af64064a4ff
MD5 d00363cce3528db56f25f37befb3c7fc
BLAKE2b-256 3e5a690fd7956c46c3db53f7a73bf8c0eecc4d1aff04c1051c4f6d5b4f340b8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_excel-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on yeongseon/sqlalchemy-excel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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