Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-08 Thread Tucker Beck
t; > "/Users/tbeck/.virtualenvs/cem/lib/python3.5/site- > packages/sqlalchemy/sql/visitors.py", > > line 81, in _compiler_dispatch > > return meth(self, **kw) > > File > > "/Users/tbeck/.virtualenvs/cem/lib/python3.5/site- > packages/sqlalchemy/sql

Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-08 Thread Tucker Beck
nsupportedCompilationError: Compiler can't render element of type Is there any way to address this? We print the generated query out in our debug logging, and it's useful. Would prefer to not have to avoid printing the query On Monday, November 6, 2017 at 3:01:30 PM UTC-8, Mike Bayer wr

Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-06 Thread Tucker Beck
OK. So, I'm guessing that the type_ parameter is meant to override the type that is inferred at creation time. Is that right? On Mon, Nov 6, 2017 at 9:49 AM, Mike Bayer <mike...@zzzcomputing.com> wrote: > On Mon, Nov 6, 2017 at 12:37 PM, Tucker Beck <tucker.b...@gmail.

Re: [sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-06 Thread Tucker Beck
That fixed it. I'm a bit surprised that passing the type_ argument doesn't seem to work. Is that a bug or not how that argument is intended to be used? On Friday, November 3, 2017 at 1:52:21 PM UTC-7, Mike Bayer wrote: > > On Fri, Nov 3, 2017 at 2:42 PM, Tucker Beck <tucke...@

Re: [sqlalchemy] Trying to get filtering and ordering to work with hybrid properties in single table inheritance

2017-11-03 Thread Tucker Beck
UTC-7, Mike Bayer wrote: > > the correlate_except tells it exactly what to "correlate" and what not > to, preventing that "auto-correlation" error. > > try it out and then show me how you'd like the SQL to be adjusted > given a particular Query. > >

[sqlalchemy] selecting with an empty array in with_entities doesn't seem to work

2017-11-03 Thread Tucker Beck
I'm writing a recursive cte with sqlalchemy, and I want it to aggregate things in an array as it recurses. However, I'm having trouble initializing the 'top' half of the cte with an empty array. I've distilled the problem down the the basic problem of including an empty array in an

Re: [sqlalchemy] Trying to get filtering and ordering to work with hybrid properties in single table inheritance

2017-10-31 Thread Tucker Beck
extra protection with correlation, correlate_except looks like this: > > @classmethod > def hybrid_type_name_subquery(cls): > return select([HybridType.name]).\ > where(HybridType.id == cls.hybrid_type_id).\ > correlate_except(HybridType).as_sca

Re: [sqlalchemy] Trying to get filtering and ordering to work with hybrid properties in single table inheritance

2017-10-31 Thread Tucker Beck
mplicit_correlate_froms=asfrom_froms) File "/home/tbeck/.virtualenvs/cem/lib/python3.5/site-packages/sqlalchemy/sql/selectable.py", line 2843, in _get_display_froms "manually." % self) sqlalchemy.exc.InvalidRequestError: Select statement 'SELECT hybrid_types.name FROM hybr

[sqlalchemy] Trying to get filtering and ordering to work with hybrid properties in single table inheritance

2017-10-30 Thread Tucker Beck
I wrestled through getting a model heirarchy to work with single-table inheritance that is polymorphic on a hybrid attribute on this mailing list a while ago. see: https://groups.google.com/d/topic/sqlalchemy/KJXSHwbhbLA/discussion The problem I'm running into now is that it doesn't seem to

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2017-01-04 Thread Tucker Beck
pass > > > class Hybrita(HybridModel): > pass > > > e = create_engine("sqlite://", echo=True) > Base.metadata.create_all(e) > session = Session(e) > > > session.add(HybridType(name=HybridAlpha.hybrid_type_identity)) > session.add(HybridType(name=Hybrita.h

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-12-29 Thread Tucker Beck
; > > On 12/27/2016 04:36 PM, Tucker Beck wrote: > >> Mike (or whoever else might have insight): >> >> I used the pattern above, and it worked great until I tried use it for a >> really large table that I was querying and filtering by the hybrid >> prop

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-12-28 Thread Tucker Beck
Another update on this issue. It seems that the issue stems from having a declared_attr for the __tablename__. If I remove that and make it a static class attribute, things work as expected. On Tue, Dec 27, 2016 at 1:36 PM, Tucker Beck <tucker.b...@gmail.com> wrote: > Mike (or whoever e

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-12-27 Thread Tucker Beck
I might resolve this issue? On Sat, Dec 3, 2016 at 4:25 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 12/01/2016 05:29 PM, Tucker Beck wrote: > >> This is what I ended up with, and it *seems* to work pretty well. Does >> my approach here pass the sniff

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-12-03 Thread Tucker Beck
sion.query(HybridAlpha).one().hybrid_type_name) session.query(HybridAlpha).one().hybrid_type_name = 'beta' print(session.query(HybridBeta).all()) On Wed, Nov 30, 2016 at 7:20 AM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 11/29/2016 07:31 PM, Tucker Beck wrote: > >> Than

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-11-29 Thread Tucker Beck
the need for the hybrid property hybrid_type_name...that is, except for the setter. Is there a way to give a column_property a setter? On Tue, Nov 29, 2016 at 2:59 PM, mike bayer <mike...@zzzcomputing.com> wrote: > > > On 11/29/2016 05:01 PM, Tucker Beck wrote: > >> The issue wi

Re: [sqlalchemy] Limiting queries from single-table inheritance declarative models

2016-11-29 Thread Tucker Beck
; > On 11/28/2016 05:58 PM, Tucker Beck wrote: > >> Hello, I'm writing today about an interesting problem we ran into with >> our sqlalchemy based data store api. >> >> Our schema is based on the star-schema idea where we have a large 'fact >> table' with lots of row