Re: [sqlalchemy] Re: Polymorphic Query All regardless of subclass

2019-03-01 Thread Andrew Martin
Yeah, for dynamic pivots there are variations on that theme, but for both postgres and SQL Server, they boil down to doing something to get the columns you want to pivot and then generating the actual pivot query from that. It's always gross, and I agree--kind of wrong. It's one of those hacks

Re: [sqlalchemy] Re: Polymorphic Query All regardless of subclass

2019-03-01 Thread Mike Bayer
OK the first part of everything I get, that was the model you have, OK. The second part with that new table "single_values", is the idea that that is a simplified version of the more complex model you want to do? Also the way that CTE is being used, that is, get data from it then use that to

[sqlalchemy] Re: Polymorphic Query All regardless of subclass

2019-03-01 Thread Andrew Martin
Thanks for the reply, Mike. I should've offered the SQL equivalent of what I was going for to begin with. This is for a side project and I'm at work, so I didn't put as much thought into the question as I should've. I think the link to the Polymorphic valued vertical table is what I'm after.