Skip to main content

One ORM Wrapper to Rule Them All

Project description

Xin

A pydantic powered universal ORM wrapper for databases.

This is a python package I created to reuse some functionalities I have had to implement in multiple jobs. For some reason, there aren't any ORM wrappers we can just plug and play. This should help in that area to some extent. I am trying to make it as generalized as possible but data storage services that require paid access may never be part of this package.

pre-commit.ci status Build, Test and Publish codecov Documentation Status

Features

  • Execute queries on a database.
  • Read a database table as a dataframe.
  • Write a dataframe to a database table (still under development).
  • Flatten and normalize a dataframe with nested structure.
  • Serialize a dataframe as a list of pydantic models.
  • Deserialize a list of pydantic models as a dataframe.

The primary backend for parsing dataframes is polars due to it's superior performance. Xin supports pandas dataframes as well, however, they are internally converted to polars dataframes first to not compromise performance.

The backend for interacting with SQL databases is sqlalchemy because it supports async features and is the de-facto standard for communicating with SQL databases.

Databases Supported

  • MySQL
  • PostgreSQL
  • SQL Server
  • Mongodb

Async Drivers Supported

Xin is async first. It means that if an async driver is available for a database dialect, it will leverage the async driver for better performance when applicable. SQL Server driver PyMSSQL does not have an async variation yet.

  • PyMongo for Mongodb. Currently async support is in beta but since PyMongo is natively supporting async features, it's safer to use it rather than a third party package like Motor.
  • Asyncpg for PostgreSQL.
  • AioMySQL for MySQL.

Plan for Future Database Support

Test Locally

Have docker compose, tox and uv installed. Then run docker compose up -d. Create the environment

uv venv
uv sync --dev --extra formatting --extra docs
uv lock

Then run tox -p

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

univorm-0.3.2.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

univorm-0.3.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: univorm-0.3.2.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for univorm-0.3.2.tar.gz
Algorithm Hash digest
SHA256 067d889ee5b8a5b78b103ea0fa63c1373a5159ec9fcdbc74ea034a3ff038714c
MD5 dfd31aeeef5629dfeabe42c61647f5eb
BLAKE2b-256 7fa32526e11a10f36198ac18c92c3c8cf11f4dd4390fd08b06e14e864be1011a

See more details on using hashes here.

File details

Details for the file univorm-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: univorm-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for univorm-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9261a9d7de657dab9b0273e067981d73e4825437c724fd7301169f138f75171b
MD5 b4db5ac281e1a4b0caa7b25b78a845ac
BLAKE2b-256 757aa6aeda704902af192679897f9335999fbc789a5b0c67cd0083725a725c52

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 Pingdom Monitoring Sentry Error logging StatusPage Status page