Hi Michael,

I apologize for being so confusing; here's a restatement of the thing
I'm trying to solve:

I'm working on a web publishing system for a client. The project has a
BASE table which contains all the base objects and has a column called
DELETED with a value of 0 or 1. We created the view, V_BASE, to be the
primary base table so we wouldn't have to worry/think about excluding
deleted BASE items within the system. So my question...is it better to
use this view or the establish relationships within the mapper between
the objects that inherit from BASE (which are SITE, CATEGORY, PAGE,
and others) so that:

SITE has CATEGORY where DELETED=0
and
CATEGORY has PAGE where DELETED=0

To be clear, I'm asking this question not as an overall design
decision but in terms of using SQL Alchemy.

And to answer your questions:

1. A row in V_BASE is also in BASE; V_BASE is a select from BASE where
DELETED=0.

2. Regarding properties....makes sense.

3. Regarding non_primary...that also makes sense and I'm going to give
that a try and abstract the "view" from being in Oracle to being the
secondary mapper.

Thanks for your time and patience.

Cheers,

Jon

On Jun 1, 3:33 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Jun 1, 2010, at 2:39 PM, ObjectEvolution wrote:
>
> > Hi,
>
> > My project has a BASE table which contains all base objects. There is
> > a column called DELETED which has a value of 0 or 1. Finally, there is
> > V_BASE which is a view of BASE that only shows objects not deleted.
>
> > I can work with my Base object easily but when I want to view deleted
> > objects there isn't any reference to them. What I'm looking for, I
> > think, is multiple mappers for my Base class. But, some questions:
>
> already, what you say is confusing.   Is a row in V_BASE also in BASE ?  what 
> would be "referenced" here ?  wouldnt each BASE simply have the "DELETED" 
> attribute?
>
>
>
> > 1. In my second mapper I can't redefine properties, correct? But do I
> > get all the properties from the first mapper?
>
> you get all the properties from the table or selectable you are mapping onto. 
>  They need to match that of the original mapper since we are instrumenting 
> those attributes on the class.
>
> > 2. The only difference in the second mapper is that it maps to the
> > BASE table and not the V_BASE view; should the syntax be the same as
> > the first mapper with the addition of non_primary=True?
>
> I would think that non_primary=True would be on the view, the primary mapper 
> is usually on the underlying table, i.e. that which encompasses all rows and 
> is mutable.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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