Hi all,

I have the following:

class Device(Base):
...
  source_id = Column(BigInteger, primary_key=True)
...

class EventQuery(Query):
  def custommethod():
    ...

class Event(Base):
  __tablename__ = 'events'
  query = Session.query.property(query_cls = EventQuery)
...
  device_source_id = Column(BigInteger, ForeignKey("Device.source_id"))
  device = relationship(Device, backref=backref('events', lazy='dynamic'))
...

Now, Device.events returns a query of type AppenderQuery, which is fine for
some built-in methods like count() and all(). What I really need is for this
to be a query of type EventQuery, so I can call
Device.events.custommethod().

1) Is it possible to coerce AppenderQuery into a different Query class?
2) If not, is it appropriate to create a custom property on Device that will
return an EventQuery containing the equivalent query, or is there a more
proper way to do it?

Thanks,

S.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to