Re: [sqlalchemy] Undefer Hybrid Attributes

2013-03-07 Thread Michael Bayer

The hybrid attribute is a Python function that invokes when it's called.  So it 
doesn't make sense for it to be a column property since there is no attribute 
to be populated.  Undeferred also doesn't make any sense because the hybrid 
already calls a local in-Python function when accessed at the instance level, 
not a database call.

A traditional column_property() can be deferred or undeterred, and when called 
at the instance level will emit SQL to the database.

If you have an attribute that should only populate via SQL, then you need to 
just use a column_property().



On Mar 7, 2013, at 11:42 AM, Kent jkentbo...@gmail.com wrote:

 I suppose what I'm really after is a column_property (for class level) and 
 plain descriptor (for instance level), which is exactly what Hybrid 
 attributes are meant to be, but I wanted them to be part of the mapper and 
 undeferred in some cases.
 
 On Thursday, March 7, 2013 11:36:37 AM UTC-5, Kent wrote:
 I notice that Hybrid Attributes don't show up as mapper properties (since 
 they are class wide instead of mapper specific, I suppose).  I couldn't find 
 documentation on whether I can undefer these?  Or can I create a synonym or 
 column_property from a hybrid attribute in the mapper?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sqlalchemy] Undefer Hybrid Attributes

2013-03-07 Thread Kent Bower
That makes sense,
Thanks,
Kent

On Mar 7, 2013, at 12:09 PM, Michael Bayer mike...@zzzcomputing.com wrote:

 
 The hybrid attribute is a Python function that invokes when it's called.  So 
 it doesn't make sense for it to be a column property since there is no 
 attribute to be populated.  Undeferred also doesn't make any sense because 
 the hybrid already calls a local in-Python function when accessed at the 
 instance level, not a database call.
 
 A traditional column_property() can be deferred or undeterred, and when 
 called at the instance level will emit SQL to the database.
 
 If you have an attribute that should only populate via SQL, then you need to 
 just use a column_property().
 
 
 
 On Mar 7, 2013, at 11:42 AM, Kent jkentbo...@gmail.com wrote:
 
 I suppose what I'm really after is a column_property (for class level) and 
 plain descriptor (for instance level), which is exactly what Hybrid 
 attributes are meant to be, but I wanted them to be part of the mapper and 
 undeferred in some cases.
 
 On Thursday, March 7, 2013 11:36:37 AM UTC-5, Kent wrote:
 
 I notice that Hybrid Attributes don't show up as mapper properties (since 
 they are class wide instead of mapper specific, I suppose).  I couldn't 
 find documentation on whether I can undefer these?  Or can I create a 
 synonym or column_property from a hybrid attribute in the mapper?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 -- 
 You received this message because you are subscribed to a topic in the Google 
 Groups sqlalchemy group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/sqlalchemy/kO6KS88-2xU/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.