On Wed, 6 Jan 2016 13:35:18 -0800 (PST)
Danuel Williams <danujose...@gmail.com> wrote:

> Currently I am developing an application where I initialize some
> mapped tables from my DB via ORM (SqlAlchemy) within a module, and
> then I import these tables into the views I need and then perform
> operations on them within the views. This actually irks me a bit as I
> feel that I should be doing all my DB work within that same module
> within which I initialized my mapped tables. I am just wondering what
> best practices dictate when it comes to using an ORM with Pyramid.

I can't really speak to "best practices".  I use the method
of the pyramid orm scaffold.  A module to declare the models,
mystuff/__init__.py imports Base and DBSession and it's main() 
uses them to setup SQLAlchemy with an engine.  Then the views 
import the model classes and do the work.  SQLAlchemy takes care 
of the details involved in loading new class objects with db content
and making changes persistent.

Does this help?

Karl <k...@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein

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

Reply via email to