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

2019-02-05 Thread Mike Bayer
On Tue, Feb 5, 2019 at 11:51 AM 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. > > This is the

Re: [sqlalchemy] Using on_conflict_do_update to merge JSON data

2019-02-05 Thread Mike Bayer
On Tue, Feb 5, 2019 at 11:15 AM wrote: > > Using: > SQLAlchemy 1.2.1 > PostgreSQL 10.6 > > I have a table with a pk and jsonb data and would like to do an upsert that > merges the json data > > Example SQL: > > INSERT INTO json_data (id, data) > VALUES (%(id)s, %(data)s) > ON CONFLICT ON

[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

[sqlalchemy] Using on_conflict_do_update to merge JSON data

2019-02-05 Thread mcsloe
Using: SQLAlchemy 1.2.1 PostgreSQL 10.6 I have a table with a pk and jsonb data and would like to do an upsert that merges the json data Example SQL: INSERT INTO json_data (id, data) VALUES (%(id)s, %(data)s) ON CONFLICT ON CONSTRAINT json_data_pk DO UPDATE SET data =

Re: [sqlalchemy] @hybrid_property - Understanding when python vs. sql/expression is used

2019-02-05 Thread Mike Bayer
On Tue, Feb 5, 2019 at 9:22 AM Gmoney wrote: > > We have some elaborate logic in a a @hybrid_property and > @.expression that I'm keen on setting up some testing to > ensure that both cases return the same value. I'm having some difficulty > sorting out when each version is used at any given

[sqlalchemy] @hybrid_property - Understanding when python vs. sql/expression is used

2019-02-05 Thread Gmoney
We have some elaborate logic in a a @hybrid_property and @.expression that I'm keen on setting up some testing to ensure that both cases return the same value. I'm having some difficulty sorting out when each version is used at any given time though. @hybrid_property def