Adding Orator ORM#549
Conversation
|
What's the biggest strength of Orator if we compare it with other ORM like SQLAlchemy? |
|
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 UserAlso, 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. |
|
@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 |
|
@sdispater I used Orator in my side project recently, I really like it! So, would you mind resolving conflicts and submitting PR again? |
|
Glad you like it :-) I just updated the PR. |
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: