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.2.1.tar.gz (17.3 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.2.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for univorm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6a4f20d02905e7a418cba43d1e175d57e0840260063b41dfbd0f3eb49d59528e
MD5 ac449512b8cf2c925cc0b741c9e0728b
BLAKE2b-256 862efa64ba784840ededd626312aa7b2644644844aeab670250b07f2af1c795e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for univorm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20d3ce638497a409b14b45fc9baef65a79931ffc644825c22b76996eecc29542
MD5 53d460c553147d5f63ae162e0a4d1ec3
BLAKE2b-256 67bb770a810fb5c51402ba2943ebc0d1debac14b3c29d46d03f2963413dcb764

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