Re: [sqlalchemy] sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'PPESSOA' expected to update 1 row(s); 0 were matched.

2023-08-22 Thread Mike Bayer
if it's fully reproducible every time with both statements, then this suggests 
something is happening with the database server itself, such as some kind of 
issue with triggers getting involved or something.   In particular if this is 
MS SQL Server and there are triggers involved, the updated rowcount might not 
be working correctly and extra steps might need to be taken to turn off 
SQLAlchemy's rowcount facilities.

you want to turn on `echo=True` and see that the expected UPDATE statement 
takes place.  Then you might want to try running those UPDATE statements 
directly on the database and see that they work.

What database backend, what database driver, and is the issue only reproducible 
in a single environment or can it be reproduced elsewhere?


On Tue, Aug 22, 2023, at 2:42 PM, Leandro Lázaro wrote:
> Hello
> 
> First, thanks for building this library. God bless you
> 
> 
> I've been trying to understand what's going on for days.
> 
> This code works fine:
> 
> https://pastebin.com/fLTnB8jy
> 
> But if I try to modify any other parameter like PERSONAL EMAIL I get the 
> error:
> 
> sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'PPESSOA' 
> expected to update 1 row(s); 0 were matched 
> 
> Example: https://pastebin.com/EwdwLRcp
> 
> Tank you
> 
> 
> -- 
> 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/c2939c34-4d95-4fe8-b697-afc705b47a11n%40googlegroups.com
>  
> .

-- 
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/aafd2f50-d3c7-4018-90e7-3eddbbd9d6db%40app.fastmail.com.


[sqlalchemy] sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'PPESSOA' expected to update 1 row(s); 0 were matched.

2023-08-22 Thread Leandro Lázaro
Hello

First, thanks for building this library. God bless you 

I've been trying to understand what's going on for days.

This code works fine:

https://pastebin.com/fLTnB8jy

But if I try to modify any other parameter like PERSONAL EMAIL I get the 
error:

sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'PPESSOA' 
expected to update 1 row(s); 0 were matched 

Example: https://pastebin.com/EwdwLRcp

Tank you

-- 
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/c2939c34-4d95-4fe8-b697-afc705b47a11n%40googlegroups.com.