Async ORM based on PyPika
Project description
PyPika-ORM - ORM for PyPika SQL Query Builder
The package gives you ORM for PyPika with asycio support for a range of databases (SQLite, PostgreSQL, MySQL).
Warning
The project is in early pre-alpha state and not ready for production
Requirements
- python >= 3.7
Installation
pypyka-orm should be installed using pip:
$ pip install pypika-orm
You can install the required database drivers with:
$ pip install pypika-orm[sqlite]
$ pip install pypika-orm[postgresql]
$ pip install pypika-orm[mysql]
Usage
from pypika_orm import Model, fields
class Role(Model):
id = fields.Auto()
name = fields.Varchar(max_length=100, default='user')
class User(Model):
id = fields.Auto()
name = fields.Varchar()
is_active = fields.Bool(default=True, null=False)
role_id = fields.ForeignKey(Role.id)
from pypika_orm import Manager
async with Manager('sqlite:///:memory:') as manager:
await manager(Role).create_table().if_not_exists()
await manager(User).create_table().if_not_exists()
await manager(Role).insert(name='user')
await manager(User).insert(name='jim', role_id=1)
[user] = await manager(User).select().fetchall()
assert user
Bug tracker
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/pypika-orm/issues
Contributing
Development of the project happens at: https://github.com/klen/pypika-orm
License
Licensed under a MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypika-orm-0.0.15.tar.gz
(8.2 kB
view hashes)
Built Distribution
Close
Hashes for pypika_orm-0.0.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82896da0cae362715fff02fbb22caa94e4c57ce9078e1eb3d43b83e72d3f47de |
|
MD5 | 533f4a5f2313ed518d5e6bd091b61749 |
|
BLAKE2b-256 | 11d053991f4d3d7b57b4f23f6a185f7aba26aaccdf83cb768e394250f4d3714e |