> ...> To clarify:
>
> > I am using SQLAlchemy's Declarative Base to fully define and create my
> > database.
>
> > For instance, there is a simple class/table Records, and I would like
> > to define a class CurrentRecords that is implemented in the database
> > as a view on Records.
>
> > In this way, I can avoid polluting my application code with filtering
> > out all the non-active records every time I want to query Records.
>
> Just define CurrentRecords as a table, i.e. in my app one of my views is:
>
> class Vconsumption(Base):
>     __table__ = sa.Table(u'vconsumption', metadata,
>     sa.Column(u'consumptionid', sa.Integer(),
> sa.ForeignKey(u'consumption.consumptionid'), primary_key=True),
> ...
>     )
>
>     consumption = sao.relation(Consumption)
>
> And I relate it back to the real consumption table, but never
> write/flush the view and do have to have a unique key which you define
> as "primary key" to SA.
>
> Werner

What functional gain does this approuch provide over just querying the
Consumption table?  I am not clear on how you are using this....  can
you clarify?

As an aside, I wonder if it is possible to just subclass my Records
object so that the CurrentRecords class adds/enforces certain
filter_by parameters for any query against it.

Thank you.  :)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to