Skip to main content

A small and lightweight ORM

Project description

RACCY-ORM

OVERVIEW

Raccy-ORM is a small lightweight ORM, inspired by Django-ORM.

REQUIREMENTS

  • Python 3.7+
  • Works on Linux, Windows, and Mac

INSTALL

pip install raccy-orm

EXAMPLE

from datetime import datetime as dt
import ro as model

config = model.Config()
config.DATABASE = model.SQLiteDatabase(':memory:')


class Author(model.Model):
    author_id = model.PrimaryKeyField()
    name = model.CharField(max_length=75)
    age = model.IntegerField()
    lucky_number = model.IntegerField(default=90)
    salary = model.FloatField(default=50000)
    date = model.DateField()
    datetime = model.DateTimeField()
    adult = model.BooleanField(default=False)


class Post(model.Model):
    author_id = model.ForeignKeyField(Author, 'author_id')
    post = model.TextField(null=False)


Author.objects.bulk_insert(
    dict(name='Kwame', age=45, date=dt.now().date(), datetime=dt.now(), lucky_number=99, salary=6400),
    dict(name='Yaw', age=32, date=dt.now().date(), datetime=dt.now(), lucky_number=56, salary=6400),
    dict(name='Fiifi', age=23, date=dt.now().date(), datetime=dt.now(), lucky_number=34),
    dict(name='Navas', age=21, date=dt.now().date(), datetime=dt.now()),
    dict(name='Jesus', age=34, date=dt.now().date(), datetime=dt.now(), salary=6400, adult=True)
)
Post.objects.insert(post="This is Kojo's post", author_id=1)
Post.objects.insert(post="This is Kwabena's post", author_id=2)
Post.objects.insert(post="This is Baffour's post", author_id=3)
Post.objects.insert(post="This is Derrick's post", author_id=1)


for d in Author.objects.all():
    print(d.pk, d.name)
1 Kwame
2 Yaw
3 Fiifi
4 Navas
5 Jesus

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

raccy_orm-0.0.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file raccy_orm-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: raccy_orm-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.8

File hashes

Hashes for raccy_orm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cca875e057d89f3bbc69b7fd829aae7c734314f3e2b6ed92d3a1bf091cb81971
MD5 0c6357553e5529fac7c39cb5e7733323
BLAKE2b-256 c5d4bb7425bc6f16094744b3fd88d46fb03cf02e69b29be4d0034fdaa9331967

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