[sqlalchemy] Re: Single table inheritance and mapping against a selectable

2007-07-28 Thread Gaetan de Menten

On 7/28/07, Michael Bayer [EMAIL PROTECTED] wrote:

 those are fine with me.  if someone could add a ticket and/or
 implement that would be helpful.

http://www.sqlalchemy.org/trac/ticket/696

-- 
Gaëtan de Menten
http://openhex.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Single table inheritance and mapping against a selectable

2007-07-27 Thread Michael Bayer


On Jul 27, 2007, at 4:03 PM, Gaetan de Menten wrote:

 so do you just want explicit_columns=True so that no auto-grabbing
 of columns occurs ?

 I don't know exactly what I want (or maybe it's just I don't care how
 it's done). It's just that I found it suboptimal that in some cases
 the columns you select are embedded in the from clause while what
 you want is modify what is selected before the from clause, whether
 this is columns or more complex expressions.
 --  

yeah look, this is how it works.  your table has x, y, and z.  you  
set up a mapper.  x, y and z all become ColumnPropertys on your  
mapper, without you doing anything, i.e. no properties dict.  if you  
set up a properties dict, columns which you map explicitly will  
override the normal x, y, z properties...but the rest just get set up  
normally.

so waht you want is this:

mapper(X, table, properties={
'x':table.c.x,
   'y':table.c.y
}, explicit_columns=True)

which means, set up x and y, but dont go setting up everything else  
inside of table.c (i.e., no z).



  
   

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Single table inheritance and mapping against a selectable

2007-07-27 Thread Gaetan de Menten

On 7/27/07, Michael Bayer [EMAIL PROTECTED] wrote:


 On Jul 27, 2007, at 4:03 PM, Gaetan de Menten wrote:

  so do you just want explicit_columns=True so that no auto-grabbing
  of columns occurs ?
 
  I don't know exactly what I want (or maybe it's just I don't care how
  it's done). It's just that I found it suboptimal that in some cases
  the columns you select are embedded in the from clause while what
  you want is modify what is selected before the from clause, whether
  this is columns or more complex expressions.
  --

 yeah look, this is how it works.  your table has x, y, and z.  you
 set up a mapper.  x, y and z all become ColumnPropertys on your
 mapper, without you doing anything, i.e. no properties dict.  if you
 set up a properties dict, columns which you map explicitly will
 override the normal x, y, z properties...but the rest just get set up
 normally.

 so waht you want is this:

 mapper(X, table, properties={
 'x':table.c.x,
'y':table.c.y
 }, explicit_columns=True)


 which means, set up x and y, but dont go setting up everything else
 inside of table.c (i.e., no z).

Yeah, that's exactly what I want, except the name explicit_columns
might not be the best. I'd find it natural to be able to put more
complex expressions/properties than simple columns (as in other
mappers), and that name would suggest we can't. I'd rather see the
opposite principle: something along the lines of map_all_columns=False
(though I'm not sold on that particular term).


-- 
Gaëtan de Menten
http://openhex.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Single table inheritance and mapping against a selectable

2007-07-27 Thread sdobrev

  yeah look, this is how it works.  your table has x, y, and z. 
  you set up a mapper.  x, y and z all become ColumnPropertys on
  your mapper, without you doing anything, i.e. no properties dict.
   if you set up a properties dict, columns which you map
  explicitly will override the normal x, y, z properties...but the
  rest just get set up normally.
 
  so waht you want is this:
 
  mapper(X, table, properties={
  'x':table.c.x,
 'y':table.c.y
  }, explicit_columns=True)
 
 
  which means, set up x and y, but dont go setting up everything
  else inside of table.c (i.e., no z).

 Yeah, that's exactly what I want, except the name explicit_columns
 might not be the best. I'd find it natural to be able to put more
 complex expressions/properties than simple columns (as in other
 mappers), and that name would suggest we can't. I'd rather see the
 opposite principle: something along the lines of
 map_all_columns=False (though I'm not sold on that particular
 term).
what about include_props=[..] and exclude props=[..] ? 
i'd rather not list again and again props on inheriting mappers..


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Single table inheritance and mapping against a selectable

2007-07-27 Thread Michael Bayer

those are fine with me.  if someone could add a ticket and/or
implement that would be helpful.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---