Skip to content

Adding Orator ORM#549

Merged
vinta merged 3 commits intovinta:masterfrom
sdispater:add-orator
Jan 19, 2017
Merged

Adding Orator ORM#549
vinta merged 3 commits intovinta:masterfrom
sdispater:add-orator

Conversation

@sdispater
Copy link
Contributor

Orator is a brand new ORM for Python following the ActiveRecord pattern with a pinch of magic in it.

Its main goal is simplicity and to be really easy to read and write with useful features out of the box (relationships decorators, timestampable models, soft deletes, protection against mass assigment, model events, caching).

An example of a simple model:

from orator import Model


class User(Model):

    __fillable__ = ['name', 'email']

    @has_many
    def posts(self):
        return Post

@vinta
Copy link
Owner

vinta commented Feb 1, 2016

What's the biggest strength of Orator if we compare it with other ORM like SQLAlchemy?

@sdispater
Copy link
Contributor Author

To sum it up: simplicity.

When I started Orator (inspired by the Eloquent ORM), I wanted it to be easy to understand compared to the existing ORMs (SQLAlchemy or Peewee). Like Rails' ActiveRecord in Ruby, where relationships are easy to understand at a glance, for example.

Let's take an example:

# SQLAlchemy
class User(Base):

    __tablename__ = 'users'

    company_id = Column(
        Integer, ForeignKey('companies.id'),
        nullable=False, index=True
    )

    company = relationship(
        'Company',
        backref=backref('users',
                        cascade='all, delete')
    )
class User(Model):

    @belongs_to
    def company(self):
        return Company


class Company(Model):

    @has_many
    def users(self):
        return User

Also, Orator comes bundled with useful features (for instance, migrations, factories to ease creating fixtures in tests, soft-deletable models) that make starting a project with Orator faster and, in my opinion, in a more natural way.

I admit that Orator does not cover the range that SQLAlchemy does but it's be design since I want Orator to stay simple.

@sdispater
Copy link
Contributor Author

@vinta What do you think? Does it fill the criteria to be awesome?

Also look at the release log for the latest 0.8 version released after this pull request has been made: https://orator-orm.com/blog/orator-0-8-is-out.html

@vinta
Copy link
Owner

vinta commented Jan 18, 2017

@sdispater I used Orator in my side project recently, I really like it!

So, would you mind resolving conflicts and submitting PR again?

@sdispater
Copy link
Contributor Author

Glad you like it :-)

I just updated the PR.

@vinta vinta merged commit e2fd5d8 into vinta:master Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants