I have a mixin of the following form

class MyMixin(object):
    idx = sa.Column(sa.Integer, sa.Sequence('idx_seq', schema=???, 
optional=True), primary_key=True)

I would like the sequence to have the same schema as the table into which 
MyMixin will be mixed. I realize I could make idx a declared_attr, and then 
extract the schema from the provided cls -- and this is probably the 
"right" solution -- but that would lead to the idx column going at the end 
of the column list, and I really want it at the beginning. (Yes, this is 
just for silly aesthetics, but *all* my tables start with idx, and I'd like 
ones using MyMix to do so too.)

Is it possible to define the idx column without the sequence, and then 
afterwards create the sequence and add it to the column? Or alternatively 
define the sequence's schema at some later stage? Or better yet, is there 
some magic setting of the sequence's schema that will have it "inherit" 
from the containing table (I realize that in general sequences don't have 
"containing tables")?

SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper


To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to