DuckORM
The Duck-ORM
package is an asynchronous ORM for Python, with support for Postgres and SQLite. ORM is built with:
Requirements: Python 3.8+
Duck-ORM is still under development.
Installation
1 |
|
Note
Don't forget to install databases
before installing duck-orm
.
Quickstart
For this example we will create a connection to the SQLite database and create a model.
1 2 |
|
Note that we want to use ipython
here, because it supports using await expressions directly from the console.
Creating the connection to the SQLite database:
1 2 3 4 5 |
|
Defining a model:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
- The
__tablename__
attribute is used to define the table's name in the database. - The
__db__
attribute is the instance of the database connection. - And then the definition of the fields, their types and restrictions.
- And finally, the table creation in the database.
License
DuckORM
is built as an open-source tool and remains completely free(MIT license).