Le 14/11/2012 06:19, Michael Bayer a écrit :
On Nov 13, 2012, at 3:34 AM, tonthon wrote:
Hi,
I'm using polymorphism for some of my models and I'm wondering how I
should use the with_polymorphic query method.
Consider the following:
class A(Base):
type_ = Column(Integer,
Hi,
I'm using polymorphism for some of my models and I'm wondering how I
should use the with_polymorphic query method.
Consider the following:
class A(Base):
type_ = Column(Integer, nullable=False)
arg = Column(String(20))
__mapper_args__ = {'polymorphic_on': type_,
On Nov 13, 2012, at 3:34 AM, tonthon wrote:
Hi,
I'm using polymorphism for some of my models and I'm wondering how I
should use the with_polymorphic query method.
Consider the following:
class A(Base):
type_ = Column(Integer, nullable=False)
arg = Column(String(20))
Hi *,
is there a way to use the with_polymorphic mapper option for classes yet
to be defined?
My problem is that I have a base class for a number of different
database objects. There are few specific leafs classes of which many
instances are loaded at once.
Currently, I pass
perhaps we'd want to establish mapper.with_polymorphic as a setter that will
perform the requisite validations on it whenever it is set.I think you can
set it right now on the mapper at any point, it doesn't seem to be consulted in
any configurational way. The only validations that occur
Hello,
Another quick question on .with_polymorhpic() .. :)
When I use inheritance I always subclass a Query object per mapped
(child) class, for example :
class QueryRoot(orm.Query):
def available_to_all_children(self):
return self.filter(...)
class RootModel(object):
query =
On Sep 2, 2010, at 8:59 AM, Julien Cigar wrote:
Hello,
Another quick question on .with_polymorhpic() .. :)
When I use inheritance I always subclass a Query object per mapped (child)
class, for example :
class QueryRoot(orm.Query):
def available_to_all_children(self):
return
On 09/02/2010 17:55, Michael Bayer wrote:
On Sep 2, 2010, at 8:59 AM, Julien Cigar wrote:
Hello,
Another quick question on .with_polymorhpic() .. :)
When I use inheritance I always subclass a Query object per mapped (child)
class, for example :
class QueryRoot(orm.Query):
def
Hello,
Quick question, is there a way to use .with_polymorphic() on a Query
with existing criterion ?
I have the case where I have 2 queries with the same criteria where one
of those queries is a count(*). I would like to avoid multiple LEFT JOIN
because criteria in the count(*) query
On Aug 30, 2010, at 5:59 AM, Julien Cigar wrote:
Hello,
Quick question, is there a way to use .with_polymorphic() on a Query with
existing criterion ?
I have the case where I have 2 queries with the same criteria where one of
those queries is a count(*). I would like to avoid multiple
On 08/30/2010 16:06, Michael Bayer wrote:
On Aug 30, 2010, at 5:59 AM, Julien Cigar wrote:
Hello,
Quick question, is there a way to use .with_polymorphic() on a Query with
existing criterion ?
I have the case where I have 2 queries with the same criteria where one of
those queries is a
Hello,
I have the following mappers:
orm.mapper(Content, table.content,
polymorphic_on = table.content.c.content_type_id,
...)
orm.mapper(News, table.news, inherits = Content,
polymorphic_on = table.content.c.content_type_id)
orm.mapper(PlatformNews, table.platform_news,
On Jul 16, 2010, at 7:34 AM, Julien Cigar wrote:
Hello,
I have the following mappers:
orm.mapper(Content, table.content,
polymorphic_on = table.content.c.content_type_id,
...)
orm.mapper(News, table.news, inherits = Content,
polymorphic_on = table.content.c.content_type_id)
What is the difference between:
session.query(Employee).join([Engineer, Manager]).\
filter(or_(Engineer.engineer_info=='w',
Manager.manager_data=='q'))
and
session.query(Employee).with_polymorphic([Engineer, Manager]).\
filter(or_(Engineer.engineer_info=='w',
Manager.manager_data=='q'))
On Apr 1, 2010, at 8:22 PM, Kent wrote:
What is the difference between:
session.query(Employee).join([Engineer, Manager]).\
filter(or_(Engineer.engineer_info=='w',
Manager.manager_data=='q'))
and
session.query(Employee).with_polymorphic([Engineer, Manager]).\
15 matches
Mail list logo