[sqlalchemy] Re: Using operators with multiple InstrumentedAttribute instances

2019-03-29 Thread Ian Miller
r each individual metric - what I need to figure out how to do is to be able to build a SQLAlchemy ORM query by parsing the formula string, and evaluating each operation in the context of the query. `func.sum` would work for formula1, but I'd need to iteratively build the formula wit

[sqlalchemy] Using operators with multiple InstrumentedAttribute instances

2019-03-28 Thread Ian Miller
Hello all, I am in the process of trying to create a dynamic expression query engine in an application I'm working on. So there is a formula that gets defined like so: formula = '"metric:123" + "metric:456" + "metric:789"' Each metric maps to a column in the database tables - long story

Re: [sqlalchemy] Re: Unable to reference label in subquery at top level of query

2019-02-07 Thread Ian Miller
:facepalm: i should have seen that much sooner. Thank you so much for your help. No longer need to do any of that crazy stuff I attempted! On Thursday, February 7, 2019 at 5:13:41 PM UTC-5, Mike Bayer wrote: > > On Thu, Feb 7, 2019 at 2:49 PM Ian Miller > wrote: > > >

Re: [sqlalchemy] Re: Unable to reference label in subquery at top level of query

2019-02-07 Thread Ian Miller
le to keep track of the position of the column in the query, and replace with the rebuilt column accordingly. On Thursday, February 7, 2019 at 12:53:51 PM UTC-5, Mike Bayer wrote: > > just as a note, don't access .c._all_columns, just iterate over > selectable.c > > On Thu, Feb 7, 20

Re: [sqlalchemy] Re: Unable to reference label in subquery at top level of query

2019-02-07 Thread Ian Miller
Enter code here... On Thursday, February 7, 2019 at 12:53:51 PM UTC-5, Mike Bayer wrote: > > just as a note, don't access .c._all_columns, just iterate over > selectable.c > > On Thu, Feb 7, 2019 at 10:45 AM Ian Miller > wrote: > > > > Hello Mike, >

[sqlalchemy] Re: Unable to reference label in subquery at top level of query

2019-02-07 Thread Ian Miller
9 at 11:51:25 AM UTC-5, Ian Miller wrote: > > Hello all - > > I am relatively new to using SQLAlchemy for more complex use cases. I am > in the process of creating a time series query, but I am unable to > reference a column by its alias at the top level of the query. > >

[sqlalchemy] Re: Unable to reference label in subquery at top level of query

2019-02-07 Thread Ian Miller
t_metadata_4.schema_uid = :schema_uid_2 AND post_metadata_4.metadata_name = :metadata_name_2 AND vw_post.license_id IN (:license_id_1, :license_id_2) GROUP BY vw_post.created_at, post_metadata_3.metadata_value, post_metadata_4.metadata_value, vw_post.created_at) AS non_interval_query,

[sqlalchemy] Unable to reference label in subquery at top level of query

2019-02-05 Thread Ian Miller
Hello all - I am relatively new to using SQLAlchemy for more complex use cases. I am in the process of creating a time series query, but I am unable to reference a column by its alias at the top level of the query. This is the query that I am trying to address that SQLAlchemy is currently