[sqlalchemy] now with code goodness: problems with single-table inheritance and column_properties?

2010-08-05 Thread Zippy P
I have the following code: from objects import * class Device(Base): __tablename__=testdev devtype = Column(Unicode(20), primary_key = True) __mapper_args__ = {'polymorphic_on': devtype} mac = Column(Unicode(128), primary_key = True) switch_mac = Column(Unicode(128), ForeignKey(mac)) switch =

[sqlalchemy] inheritance and column_property() - subqueries are being limited

2010-08-04 Thread Zippy P
I have a single-table inheritance setup: class Device(Base): __tablename__ = 'devices' devtype = Column(Unicode(20), nullable = False) mac = Column(Unicode(128), primary_key = True) ... class PC(Device): __mapper_args_ = {'polymorphic_identity':u'PC'} switch_mac =

[sqlalchemy] Returning an attribute from an object when using query_property()?

2010-08-02 Thread Zippy P
Hi all: I have the following code: class EventQuery(Query): def histogram(self): ''' return a histogram of source / count(source) given an eventquery'' ... ... class Event(Base): __tablename__ = 'events' query = Session.query_property(query_cls = EventQuery) name =

[sqlalchemy] lazy = 'dynamic' and coercing AppenderQuery to a new object class

2010-07-27 Thread Zippy P
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 =