Skip to main content

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).

Tests Status PYPI Version Python Versions

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().execute()
        await manager(User).create_table().if_not_exists().execute()

        await manager(Role).insert(name='user').execute()
        await manager(User).insert(name='jim', role_id=1).execute()

        [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/aio-databases/issues

Contributing

Development of the project happens at: https://github.com/klen/aio-databases

License

Licensed under a MIT License

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

pypika-orm-0.0.14.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

pypika_orm-0.0.14-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pypika-orm-0.0.14.tar.gz.

File metadata

  • Download URL: pypika-orm-0.0.14.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for pypika-orm-0.0.14.tar.gz
Algorithm Hash digest
SHA256 c8c580e7d4152ee6a1686091a0604bac03a67112577201eb9eb14cff864a308d
MD5 b31b41cf3b806dd924979ef87c1f591f
BLAKE2b-256 57034bb356b3dfbd6bdb83d2f3f5dfbfbd5b9f31022ee41fea5b299d6b1edff2

See more details on using hashes here.

File details

Details for the file pypika_orm-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: pypika_orm-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for pypika_orm-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 36430b00bf97230b21679e18d2edc94138a645bfd6101f84677ad411cc956f0a
MD5 090267c3794857ab95c592d22fe7fb18
BLAKE2b-256 ffd3975d3abcbc9f698f391b8a64710433656d5c7468ac44e6a5953455b3a72f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page