just to add, getting full flexibility in abstract concrete loading is
possibly technically feasible, I have some ideas here, but would
require a lot of effort on my part. i have ideas how to get what you
want but it's nothing trivial or that I have any near-term
availability to work on. But
you can use multiple types, but the question is if you want to *load*
multiple subtypes *at the same time* while not loading othersif
you need to load sub-groups of subtypes all at once then
AbstractConcreteBase is going to create lots of problems for you and
it probably can't handle this use
if you only need to load against one sub-type at a time, then you
shouldn't use any polymorphic features or concrete inheritance. Make
your OrderItem just a non-mapped mixin class, then OrderItemTest and
whatever else are just normal mapped-to-one-table classes.
On Wed, Mar 7, 2018 at 5:39 PM,
On Wed, Mar 7, 2018 at 4:19 PM, Harshvardhan Gupta
wrote:
> Calling configure_mappers() fixes the issue.
>
> However, the next thing I tried was to do joined load ( for eager loading )
> , and it fails.
>
> This is what I tried :
>
>
> order =
>
Calling configure_mappers() fixes the issue.
However, the next thing I tried was to do joined load ( for eager loading )
, and it fails.
This is what I tried :
order = db.session.query(Order).join(Order.items.of_type(order_items)).
my test doesn't have that problem, try calling configure_mappers()
first. Try running the test case I have as given.
On Wed, Mar 7, 2018 at 4:02 PM, Harshvardhan Gupta
wrote:
> Thanks for the reply.
>
> Sorry, I will be more careful when i sent code snippets.
>
> I tried
Thanks for the reply.
Sorry, I will be more careful when i sent code snippets.
I tried this out after you asked me to remove flat =True, so the code looks
like this now :
pjoin = polymorphic_union({
'order_test_item': OrderTestItem.__table__,
}, 'type', 'pjoin') # I dont think
found a few mentions of "flat=True" that fail to specify that this
flag should **not** be used when selectable= is set, pushing extra
verbiage to that effect now. most likely with_polymorphic() should
raise an error if both flags are set.
On Wed, Mar 7, 2018 at 3:48 PM, Mike Bayer
here's a full MCVE, which with "flat=True" reproduces your issue
exactly (send me this next time). The issue is the "flat=True", take
that out because it isn't compatible with a concrete union - it
implies the "aliased" flag and that gets in the way of what the
polymorphic_union() function is
Thanks for replying.
I forgot to show the error.
It is this:
1054, "Unknown column 'pjoin.order_id' in 'on clause'") [SQL: "SELECT
`order`.id AS order_id, `order`.rp_id AS order_rp_id, `order`.user_id AS
order_user_id \nFROM `order` INNER JOIN (SELECT order_test_item.order_id AS
order_id,
On Tue, Mar 6, 2018 at 8:36 PM, Harshvardhan Gupta
wrote:
> I tried to use AbstractConcreteBase for polymorphic relationships , but I am
> getting errors. The examples in sqlalchemy cover normal polymorphism well,
> but not those with Abstract Base classes.
>
>
> I have
I tried to use AbstractConcreteBase for polymorphic relationships , but I
am getting errors. The examples in sqlalchemy cover normal polymorphism
well, but not those with Abstract Base classes.
I have already asked a question on stack overflow
12 matches
Mail list logo