PostgreSQL specific extensions to the Ormar ORM
Project description
ormar-postgres-extensions
Overview
ormar-postgres-extensions is a an extension to theOrmar ORM. It enables developers to write models that map to native PostgreSQL types.
Motivation
Ormar is an amazing async ORM that works with FastAPI. However, it is agnostic to the underlying database used meaning that we cannot use native PostgreSQL types such as UUID or JSONB columns. The aim of this library is to provide Ormar fields that can be used to generate database columns with native PG types.
Installation
python -m pip install ormar-postgres-extensions
Usage
Fields
Two native PG fields are provided. The PostgresJSONB
and PostgresUUID
types map to native JSONB
and UUID
data types respectively. Using these in an Ormar model is as simple as importing the fields and using them in the model.
from uuid import UUID
import ormar
from ormar_postgres_extensions import PostgresUUID
class MyModel(ormar.Model):
uid: UUID = PostgresUUID(unique=True, nullable=False)
Uninstalling
pip uninstall ormar-postgres-extensions
Contributing
Feel free to open a PR or GitHub issue. Contributions welcome!
To develop locally, clone this repository and run . script/bootstrap
to install test dependencies. You can then use invoke --list
to see available commands.
To run the tests locally, PostgreSQL needs to be running. This can be easily started via inv database
.
See contributing guide
Contributors
You don't really have to add this section yourself! Simply use all-contributors by adding comments in your PRs like so:
Evert Timberg 🤔 🚇 🚧 📖 ⚠️ |
@all-contributors please add <username> for <contribution type>
Find out more about All-Contributors on their website!
License
ormar-postgres-extensions
is licensed under Apache License Version 2.0.
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
Built Distribution
Hashes for ormar-postgres-extensions-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca712b6f4b4d0406feb8a31f208ba290f60fb5737fe43715d83ddc34ac207894 |
|
MD5 | bb18a0f5b3139f59e499162e4496bfe8 |
|
BLAKE2b-256 | 8fa690a20f2253a821d227cf6a60942bb371cfbabfa8225b8c4a0f71897de167 |
Hashes for ormar_postgres_extensions-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35edf7152b1aedbab42708ba5c5deddf975e3b0e6d26e7a7fe7a2654c72138aa |
|
MD5 | 23a5a0d97601f6afe14afff460ff4a9c |
|
BLAKE2b-256 | 75ae42bd83a5eec7dfd0f9e77611fc4ef5f537d998dcf2056f5e6c22ca8fa14f |