it looks like a bug unless you are manipulating the InstanceState.   I would 
upgrade 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 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 simple test with no actual changes:  
> task = Task.query.filter(blah).one()
> session.refresh(task)
> Again it works for some, not for others.
> 
> Is there was something obvious that might cause this - perhaps I'm 
> misunderstanding how refresh works?  We have numerous relationships on the 
> model that often refer to the same table (multiple 'user_id' fk references).  
> This hasn't causes us any other issues, but it's worth noting.
> 
> I will try to pare down the model to isolate what the cause is, and follow up 
> with a test case if I can.  But wanted to see if it was anything obvious 
> before I dig too deep.
> 
>   File "/-/lib/python3.7/site-packages/sqlalchemy/orm/loading.py", line 709, 
> in _populate_full

>     elif load_path != state.load_path:

>   File "-/lib/python3.7/site-packages/sqlalchemy/orm/path_registry.py", line 
> 63, in __eq__

>     return other is not None and self.path == other.path

> AttributeError: 'tuple' object has no attribute 'path'

>  

> 
> 
> 
> 

> -- 
> 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 http://stackoverflow.com/help/mcve for a full 
> description.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/007a8cae-33bc-4b5f-bdf3-e8abe1dee358n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/007a8cae-33bc-4b5f-bdf3-e8abe1dee358n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/4ce8cc26-9800-483a-a365-02a9b96767f6%40www.fastmail.com.

Reply via email to