/xin

A pydantic powered universal ORM wrapper for databases.

Primary LanguagePythonApache License 2.0Apache-2.0

Xin

A pydantic powered universal ORM wrapper for databases.

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