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.1.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.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for univorm-0.3.1.tar.gz
Algorithm Hash digest
SHA256 68796cd68ef1c81fd207322ea12e9c9be5d6ac4865bdb3f7e842d3f81740242e
MD5 69dc3fde764d61da6e4695aba0dc49e6
BLAKE2b-256 14d04560c973e14476c3cfe688cd6a6cac261303c3d4755b4f0287f44d32350b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for univorm-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfeeeb5b4bc42a3b5f134b9c047411fc4397ece4f34400fac05890c228de2b32
MD5 3c970995511cbdd9c79b901676b81e21
BLAKE2b-256 2da052584197f71380a466fb62339cee59e43ecba41808930fb716d8a3544761

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