On Sep 8, 2014, at 3:14 PM, alchemy1 <veerukrish...@hotmail.com> wrote:

> In one of the YouTube videos on SQLAlchemy Mike said that some of the large 
> users of SQLAlchemy prefer to use plain SQLAlchemy instead of SQLAlchemy ORM. 
> What are the reasons behind that?

the Core by itself is much much faster than the ORM in terms of fetching rows 
and being able to emit INSERT/UPDATE/DELETE directly with a lot less Python 
overhead.   Using the Core also corresponds to SQL execution patterns in a 1-1 
fashion.  With the ORM, you can construct SELECTs as directly as you can with 
the Core, but for persistence, the flush() process is a lot more indirect.   If 
your app doesn't have a data model that is very object oriented then the ORM 
might get in the way more than it helps.

> I'm wondering because I started off with ORM and though I like it I've been 
> wondering whether I might be better off going with plain SQLAlchemy and 
> foregoing the ORM.
> 
> What exactly would I lose if I give up the ORM that I may not realize right 
> now?
> 
> What kinds of web applications (written in Pyramid in this case) are better 
> suited to use or not use ORM?

IMHO I'd always use the ORM because I always write a traditional object model 
around my data.     I drop into Core only if I'm really trying to skip some 
process in the ORM that I know is expensive, however the whole direction of the 
ORM especially in 1.0 is to allow better ORM-level workarounds for these things.

this isn't merged yet, but you can take a peek at the performance profiling 
stuff I'm doing right now in the branch at 
https://bitbucket.org/zzzeek/sqlalchemy/src/fa7c8f88113d2e769274dee4aa4247b9c9aadec8/examples/performance/__init__.py?at=ticket_3100.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to