Hi All,
I didn't see anything in the code that could help here (except maybe
__declare_last__, but that looks like something else) but thought I'd
ask in case I'm missing something...
So, some of my mixins include columns that logically come later than the
columns defined in the class using the mixin, eg:
class Temporal(object):
value_from = Column(DateTime(), nullable=False, index=True)
value_to = Column(DateTime(), nullable=False, index=True)
@declared_attr
def value_on(cls, timestamp=None):
if timestamp is None:
timestamp=datetime.now()
return ((cls.value_from <= timestamp) &
(cls.value_to > timestamp))
class Observation(Temporal, Base):
instrument_id = Column(String(10), ForeignKey('instrument.id'),
primary_key=True)
source = Column(String(10), primary_key=True)
type = Column(String(10), index=True)
value = Column(Numeric())
The value_from and value_to columns belong at the end of the definition,
but:
-> \d observation
Table "public.observation"
Column | Type | Modifiers
---------------+-----------------------------+-----------
value_from | timestamp without time zone | not null
value_to | timestamp without time zone | not null
instrument_id | character varying(10) | not null
source | character varying(10) | not null
type | character varying(10) |
value | numeric |
Not a biggie, but curious if there's a way to get them to the end...
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.