On Jan 22, 2008, at 12:11 PM, Mike Orr wrote:

>
> On Jan 22, 2008 5:17 AM, Kevin Baker <[EMAIL PROTECTED]> wrote:
>> On Jan 22, 2008, at 3:09 AM, "Antoine" <[EMAIL PROTECTED]> wrote:
>>
>> I would always use a model unless maybe if there was no db.
>
> I would use a model even if there weren't a db.  It keeps your
> "business objects" from being too closely tied to the Pylons
> implementation, which makes them easier to use outside Pylons if the
> need should arise someday.

Agreed completely.
>
>
> The beauty of SQLAlchemy is you can program on multiple levels
> simultaneously.  Define your schemas or autoload them from existing
> tables.  Use the ORM, the SQL builder methods, and/or raw SQL queries
> whenever you wish.  Like Luis, I was initially against the ORM because
> it's so magical, but I have seen how convenient and reliable it is,
> and now use it whenever possible.

I've used ORM a bunch in Java, Hibernate and custom... all about it.  
However I want to develop a standard way to build Models that don't  
need it, so if it makes sense I can use it and if not I don't have to.  
In this case I already have  a number of Flash applications that won't  
use it as my Flash apps are already setup to handle the db record  
results serialized to JSON. From scratch apps I am totally on board.

>
>
>> Also if I don't plan on ORM, I wouldn't need the object map at all
>> correct?
>
> Correct.  You won't need a session, classes, or mapper() calls.  You
> will need a metadata and Table() calls.
> Either:
>    Table("tablename", metadata, Column(...), ...)
> Or:
>    Table("tablename", metadata, autoload=True, autoload_with=engine)

hmmm this sounds interesting "autoload", I'm guessing this uses the  
table metadata to build the definition? would I find  a link to that  
in the SQLAlchemy site?


>
>
> If you someday mix ORM and non-ORM use in the same application, you
> will want to use session.execute() rather than engine.execute() for
> your non-ORM queries, so that they will be in the same transaction
> with the ORM queries.

Great advice, I will do that... on my first app I will likely reuse a  
lot of SQL I already have written. Cut and past for my deadline will  
be better than having to rewrite in SA query object notation.


Thanks Mike... very helpful response,

- Kevin



>
>
> -- 
> Mike Orr <[EMAIL PROTECTED]>
>
> >
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to