[PonyORM-list] Things preventing me to switch from SQLAlchemy
Maik Riechert
maik.riechert at arcor.de
Fri Apr 18 09:45:10 UTC 2014
Hi,
I'm starting a new project and currently use SQLAlchemy as it seems to
be the most recommended one. I have used SQLAlchemy just for a week now.
In the past I programmed some time using C# and fell in love with LINQ.
I thought that SQLAlchemy is pretty close to LINQ but as my queries grew
bigger I realized it is just a nice wrapper around raw SQL and not at
all like LINQ.
Yesterday I stumbled upon Pony ORM and was impressed! I mean, that's it!
Wouldn't it be for the nasty decompiling and AST rebuilding then that's
definitely the way to go. And I hope Python one day gets official
expression AST support like C# (maybe you can write up a suitable PEP?).
So, currently I'm on a crossroad. Either I switch to Pony ORM, enjoy
LINQ-style queries and give up some SQLAlchemy comfort/portability, or:
I stay with SQLAlchemy and just suck it up and write ugly queries.
Now, I'd like to list some missing features of Pony ORM (and available
extensions etc.) in order of importance which prevent me from easily
switching:
1. Events. E.g.:
updated = Column(DateTime, onupdate=func.now()) , or
@event.listens_for(User, 'before_insert')
def ...
2. Draw the schema as an image. I use
https://pypi.python.org/pypi/sadisplay currently combined with pydot2.
Your diagram editor (http://editor.ponyorm.com) is awesome, but it
doesn't work offline and I cannot create my models online due to
internal policies. Also, I really want to do it the opposite way: first
write model code, then generate diagram.
3. Custom types. E.g. I have a column where I store JSON and I let it
automatically marshall/unmarshall so that I only deal with the decoded
JSON:
http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#marshal-json-strings.
Another example is nicer Enum's:
http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/.
4. pg8000 support (already mentioned in other thread)
5. I don't like strings as class references (for cases where the class
is not yet defined). SQLAlchemy works around it with lambdas:
comments = relationship(lambda: Comment)
Please comment on these things to help me make a decision.
Again, I find Pony ORM great and I hope the licensing doesn't prevent it
from attracting more users (although I fear so). Also, I think you
should make it clear on your website that Pony ORM currently only works
for CPython.
Cheers
Maik
More information about the ponyorm-list
mailing list