Re: [sqlalchemy] Access __tablename__ in server_defaults?

2015-04-27 Thread Jacob Magnusson
Of course it worked! I think I was a bit tired that day...

On Thu, Apr 23, 2015 at 10:23 PM Mike Bayer mike...@zzzcomputing.com
wrote:

  if you are using __tablename__ what happens if you just refer to
 cls.__tablename__ in that method ?




 On 4/23/15 3:46 PM, Jacob Magnusson wrote:

  Would it somehow be possible to access the __tablename__ in
 server_default? What I'm looking for is something like this:

  class PositionMixin(object):
 @declared_attrdef position(cls):
 return Column(Integer, 
 server_default=text(nextval('%(__tablename__)s_id_seq')))

 ​

  --

 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.
 For more options, visit https://groups.google.com/d/optout.

  --
 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/PFAWqlf1Pm0/unsubscribe.
 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.
 For more options, visit https://groups.google.com/d/optout.


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Access __tablename__ in server_defaults?

2015-04-23 Thread Mike Bayer
if you are using __tablename__ what happens if you just refer to 
cls.__tablename__ in that method ?




On 4/23/15 3:46 PM, Jacob Magnusson wrote:
Would it somehow be possible to access the __tablename__ in 
server_default? What I'm looking for is something like this:


|class PositionMixin(object): @declared_attr def position(cls): return 
Column(Integer, 
server_default=text(nextval('%(__tablename__)s_id_seq'))) |

​

--
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 
mailto:sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com 
mailto:sqlalchemy@googlegroups.com.

Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


--
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.
For more options, visit https://groups.google.com/d/optout.