GithubHelp home page GithubHelp logo

informaticacba / orm-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from encode/orm

1.0 0.0 0.0 508 KB

An async ORM. ๐Ÿ—ƒ

Home Page: https://www.encode.io/orm

License: BSD 3-Clause "New" or "Revised" License

Shell 4.32% Python 95.68%

orm-python's Introduction

ORM

Build Status Coverage Package version

The orm package is an async ORM for Python, with support for Postgres, MySQL, and SQLite. ORM is built with:

Because ORM is built on SQLAlchemy core, you can use Alembic to provide database migrations.


Documentation: https://www.encode.io/orm


Installation

$ pip install orm

You can install the required database drivers with:

$ pip install orm[postgresql]
$ pip install orm[mysql]
$ pip install orm[sqlite]

Driver support is provided using one of asyncpg, aiomysql, or aiosqlite.


Quickstart

Note: Use ipython to try this from the console, since it supports await.

import databases
import orm

database = databases.Database("sqlite:///db.sqlite")
models = orm.ModelRegistry(database=database)


class Note(orm.Model):
    tablename = "notes"
    registry = models
    fields = {
        "id": orm.Integer(primary_key=True),
        "text": orm.String(max_length=100),
        "completed": orm.Boolean(default=False),
    }

# Create the tables
await models.create_all()

await Note.objects.create(text="Buy the groceries.", completed=False)

note = await Note.objects.get(id=1)
print(note)
# Note(id=1)

โ€” ๐Ÿ—ƒ โ€”

ORM is BSD licensed code. Designed & built in Brighton, England.

orm-python's People

Contributors

tomchristie avatar aminalaee avatar florimondmanca avatar dopry avatar chodex-xyz avatar mng-dev-ai avatar rzane avatar thiagovarela avatar andthedaysgoby avatar emiliocarrion avatar foxmask avatar gdwr avatar jastor11 avatar ryananguiano avatar timgates42 avatar lynskylate avatar

Stargazers

Alejandro Jesus del Campillo Jaime avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.