Skip to main content

aiomyorm is a simple and easy-to-use ORM framework, which has a similar interface to Django and fully supports asyncio.

Features

  • Perfect support for asyncio and uvloop.
  • Simple and easy to use API, similar to Django.
  • Support mysql and SQLite.

Installation

pip install aiomyorm

Getting Started

   from aiomyorm import Model, IntField, StringField, SmallIntField, auto_increment
   from aiomyorm import set_config, close_db_connection
   import asyncio

   set_config(engine='sqlite',
              db='test.db')


   class Test(Model):
       __table__ = 'test'
       pk = IntField(primary_key=True, default=auto_increment())
       id = StringField(50)
       age = IntField(comment='the age of student.')
       birth_place = StringField(50, default='china')
       grade = SmallIntField()


   async def go():
       insert_rows = await Test.insert(Test(pk=5000, age=18, birth_place='place1'),
                              Test(pk=5001, age=21, birth_place='place2'),
                              Test(pk=5002, age=19, birth_place='place3'))
       all = await Test.find()
       print('insert rows: ', insert_rows)
           for r in all:
               print(r)

   if __name__ == '__main__':
       loop = asyncio.get_event_loop()
       loop.run_until_complete(Test.create_table())
       loop.run_until_complete(go())
       loop.run_until_complete(close_db_connection())

the results

   to create table test.
   insert rows:  3
   pk:5000, id:, age:18, birth_place:place1, grade:0
   pk:5001, id:, age:21, birth_place:place2, grade:0
   pk:5002, id:, age:19, birth_place:place3, grade:0

more use see the document: aiomyorm

Dependencies

Tests

I have a simple test for you.

It's better for you to test in a venv.

first

git clone git@github.com:yulansp/aiomyorm.git

then

pip install -r requirements.txt

Recipe you must install MySQL and configure the user name and password in the tests/test_mysql/config.py file.

then

make test

License

MIT

Release files for aiomyorm 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiomyorm 0.2.2
File Size Uploaded
aiomyorm-0.2.2.tar.gz 23.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiomyorm 0.2.2
File Interpreter ABI Platform
aiomyorm-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 53.8 kB

Release files / aiomyorm-0.2.2.tar.gz

Download URL aiomyorm-0.2.2.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fa6af358bea2584e304198ece5f87f1144e814e650b7adcd34437703c54b2d3a
BLAKE2b-256 checksum
How to use checksums
af9ed2b1d555d013f4af02e8c0b67a11414d9d753f98d4bf8110d2c925061177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.6

Release files / aiomyorm-0.2.2-py3-none-any.whl

Download URL aiomyorm-0.2.2-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cecb58e4c8725624b1376e0ca03cd19d8906aa500fc514bf20c032fde3588cff
BLAKE2b-256 checksum
How to use checksums
27ef1adaa42910162235f3116d4be0e68db2e6d2bd07dc9ff6232c272d968cfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page