Re: [sqlalchemy] Exception on '.refresh' for certain objects - state.load_path Tuple is empty

2021-03-08 Thread Gmoney
pgrade to SQLAlchemy 1.3.23 first to make sure it hasn't been fixed. > > > > On Mon, Mar 8, 2021, at 1:09 PM, Gmoney wrote: > > On python 3.7 SQLAlchemy 1.3.13 > I'm running into an issue when doing a session.refresh(orm_object) where > for certain objects it throws an exception

[sqlalchemy] Exception on '.refresh' for certain objects - state.load_path Tuple is empty

2021-03-08 Thread Gmoney
On python 3.7 SQLAlchemy 1.3.13 I'm running into an issue when doing a session.refresh(orm_object) where for certain objects it throws an exception because in line 709 of orm/loading.py, the 'state.load_path' is an empty tuple. Attached the relevant snippet of the stack dump below. This was

Re: [sqlalchemy] HowTo define hybridproperty.expressions referencing relationship attributes

2020-12-17 Thread Gmoney
by itself, it has the same issues. Think I'm getting it... thanks so much for the explanation. On Thursday, December 17, 2020 at 11:01:17 AM UTC-5 Gmoney wrote: > I think I follow you... definitely about how it would be done in SQL and > if constructing a query manually. I think I wasn't

Re: [sqlalchemy] HowTo define hybridproperty.expressions referencing relationship attributes

2020-12-17 Thread Gmoney
ared to > our pure SQL version that would use JOINs instead of correlated subqueries, > however, I would suggest running a query plan on your target database to > see if it is in fact an issue. > > > > > > > > On Thu, Dec 17, 2020, at 10:21 AM, Gmoney wrote: >

[sqlalchemy] HowTo define hybridproperty.expressions referencing relationship attributes

2020-12-17 Thread Gmoney
Trying to understand the right way to define a hybridproperty.expression that references an 'sub-attribute' of a relationship attribute. I have done it in another case by using the class name of the relationship attribute (Tire.weight vs. cls.tire.weight) and that's worked OK. But it begs

Re: [sqlalchemy] Re: Should load_only work with hybrid properties?

2019-06-04 Thread Gmoney
ut I'm not sure this would make a good feature or not because it adds more > layers of magic to a concept that is already proving to be confusing. > > let me know if that makes sense. > > > On Mon, Jun 3, 2019, at 5:06 PM, Gmoney wrote: > > I thought I figured out another clever w

Re: [sqlalchemy] Re: Should load_only work with hybrid properties?

2019-06-03 Thread Gmoney
tely going to work. Any chance I'm just missing a step that could make that method work? I see the '.add_entity' option but that didn't seem to help and kind of defeats the purpose of my simplicity goal anyway. On Monday, June 3, 2019 at 3:57:18 PM UTC-4, Gmoney wrote: > > I think it's

Re: [sqlalchemy] Re: Should load_only work with hybrid properties?

2019-06-03 Thread Gmoney
hey are both listed at > https://docs.sqlalchemy.org/en/13/orm/mapped_sql_expr.html. > <https://docs.sqlalchemy.org/en/13/orm/mapped_sql_expr.html> > > let me know if that makes sense. > > On Mon, Jun 3, 2019, at 2:17 PM, Gmoney wrote: > > I should at least clarify that

[sqlalchemy] Re: Should load_only work with hybrid properties?

2019-06-03 Thread Gmoney
I should at least clarify that I have @hybrid_test.expression in place for that property and it works when I just do the base 'get me everything' query. On Monday, June 3, 2019 at 2:13:17 PM UTC-4, Gmoney wrote: > > I'm trying to use load_only and was able to get a really basic e

[sqlalchemy] Should load_only work with hybrid properties?

2019-06-03 Thread Gmoney
I'm trying to use load_only and was able to get a really basic example to work. My problem is that once I try to load one of my hybrid properties, it fails. This code works for any number of basic Column properties but fails once I add the hybrid property: columns = (Task.msg_id,

[sqlalchemy] Re: Return null object for outer join relationships, instead of object with all null values

2019-03-18 Thread Gmoney
Ah I'm sorry it does work how I expected... It was being changed after the query elsewhere on my end. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See

[sqlalchemy] Return null object for outer join relationships, instead of object with all null values

2019-03-18 Thread Gmoney
I have some relationships setup that are based on outer joins. When the result of the outer join is NULL (ie. it won't join), instead of having a None for that field, I get an object with all None values for that field. Is this as-designed? I can kind of understand why... but the way i"m

[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

[sqlalchemy] Re: Do autoflushes occur asynchronously?

2019-01-16 Thread Gmoney
without flushing, so I can interrogate the object and see that that FK id was changed (has a history). On Wednesday, January 16, 2019 at 4:18:36 PM UTC-5, Gmoney wrote: > > I was having a heck of confusing time debugging some code where I was > trying to determine what attrs on an OR

[sqlalchemy] Do autoflushes occur asynchronously?

2019-01-16 Thread Gmoney
I was having a heck of confusing time debugging some code where I was trying to determine what attrs on an ORM changed prior to committing it. Every time in my debugger I'd be getting different results (w/r to History). I finally realized that autoflush was enabled, and now that I disabled

Re: [sqlalchemy] How to use load_only or with_entities with relationships

2019-01-10 Thread Gmoney
, Mike Bayer wrote: > > every case is now listed out for improved error reporting in: > > https://github.com/sqlalchemy/sqlalchemy/issues/4433 > > > On Wed, Jan 9, 2019 at 12:21 AM Mike Bayer > wrote: > > > > On Tue, Jan 8, 2019 at 4:16 PM Gmoney >

[sqlalchemy] How to use load_only or with_entities with relationships

2019-01-08 Thread Gmoney
Unable to limit the columns returned from a query using .load_only or .with_entities. I feel like I'm missing a key concept here, and could use some guidance. One column of interest is a relationship - which I'm guessing is my problem. class Task(Base): __tablename__ = 'TASK' id =