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.
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.
> 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)
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.
--
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
-~----------~----~----~----~------~----~------~--~---