On Aug 27, 3:19 pm, Iain Duncan <[email protected]> wrote:

> That's interesting, so are the db views created in sql outside of your
> app or is there a way to define db views through SQLAlchemy? If outside,
> how do you integrate that with your project as far as code control and
> so on?

I create/manage the db views outside of sqlalchemy
I do two things with my apps:
  1- I maintain a directory of the current schema with 1 table per-
file
  2- I have a "db migrations" directory where i have incremental
changes to the structure, along with updating a specific db value

I only 'reflect' tables in sqlalchemy, and treat views as such.  the
only thing that sqlalchemy needs to read off them is one or more
fields to use as a primary key when you first reflect them.

i like using sqlalchemy to instantiate/save and load objects, but
that's about it.  i know sql, and am way more comfortable writing it
and fine-tuning queries than i am letting some orm do its magic and
hope that command doesn't break by the next version.



i should note something here --

I have a rather large centralized 'framework' that I run all my apps
on, and it handles all that for me.

i put 'framework' in quotes , because it is and it isn't one.  its
basically a standardized table structure that represents all core
social-network / webapp fields, and a collection of controllers and
models that can be inherited/subclassed to provide that
functionality.  it's basically an unreleased project of FindMeOn.com
that was slated to be an open-sourcing of our own systems and function
as an application bootstrap or 'embed into legacy system' method that
we started developing to deploy services for large clients.  but then
we turned into a patent lawsuit.  So the framework got put on a
backburner and has slowly been tended to by myself and a few friends.
but that handles much of this stuff.

whenever i need to add a view, i just do:

class view__myclass( SqlAlchemySmartObject ):
    __id= 'id' # or ['col1','col2']

and then my db initialization routine handles everything else.
--~--~---------~--~----~------------~-------~--~----~
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