storage for table annotations
Would be handy to have storage on Table instances for arbitrary attributes. (For use by extensions and helpers.)
e.g. I have a table annotation 'precious' that interacts with my testing framework. Currently
t = Table('foo')
t.precious = True # rather not do this
maybe instead throw this into a general attributes bucket, separate from the dialect kwargs bucket
t.attributes['precious',)](('testingthing',) = True
or, convenient but fraught:
t = Table('foo', precious=True)
Comments (7)
-
repo owner -
reporter no, this would be for higher level functionality, code operating on abstract tables and collections of tables that needs to stash state. for the example above, i have a type of MetaData that consumes these annotations and implements broad behavioral changes.
-
repo owner OK, why on Table and not on: mapper, query, session, select(), metadata, etc. ? it seems like an awfully application-specific concept to me (and as such can be handled by either sticking "attributes" on the object yourself, or by using a dictionary of tables->whatever)
-
reporter sticking an 'attributes' on myself is fine- as long as it's not going to stomp any internals. how about reserving 'attributes' on core objects for use in the Context style? not that it needs to be added anywhere now, rather that ''if'' the property is someday added to core, that's the interface it will use.
-
repo owner - assigned issue to
seems like "attributes" has been getting added to things other than table lately ? (i.e. connection ?) id say this would be Table.attributes, and if constructor-level Table(...., attributes={...}).
-
After some mailing list chat (http://tinyurl.com/243auo), I've proposed a patch.
-
- changed status to resolved
Ok, committed in 3743
- Log in to comment
any relation to
#372?