I have a mixin that declares a primary key but would like to dynamically 
override the name of it.

So for instance this is the base:

class BaseModel(object):
    @declared_attr
    def pk(self):
        return sa.Column(sa.Integer, autoincrement=True, primary_key=True)

but in some circumstances people want to use my mixin but declare the 
primary key property as id instead.

So I want to be able to do something class

class SubClass(BaseModel):
    _idAttribute = 'id'

and have it use id in the database and has the class property to reference 
instead of pk.


Is this possible?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/w6ck51oHnKcJ.
To post to this group, send email to sqlalchemy@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