Re: [sqlalchemy] Track a "column FOO does not exist" bug.

2019-09-05 Thread Mike Bayer


On Thu, Sep 5, 2019, at 7:50 AM, Riccardo Cagnasso wrote:
> I have a table Activity that had a strategic_project_name column.
> I removed the strategic_project_name column from the declarative definition 
> of the Activity table and then the strategic_project_name column from the 
> database itself.
> 
> Now I get this error message every time I try to update the one Activity 
> record.
> 
> File 
> "/home/phas/virtualenvs/o35/lib/python3.5/site-packages/SQLAlchemy-1.3.8-py3.5-linux-x86_64.egg/sqlalchemy/engine/default.py",
>  line 552, in do_execute
>  cursor.execute(statement, parameters)
> sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column 
> "strategic_project_name" does not exist
> 
> [SQL: UPDATE activity SET subtitle=%(subtitle)s WHERE activity.id = 
> %(activity_id)s]
> [parameters: {'activity_id': 200, 'subtitle': 'gjh'}]
> 
> which is very odd because the SQL doesn't contain the column 
> strategic_project_name
> 
> If I manually create a strategic_project_name column in the database activity 
> table, it starts to work again, so it's not referring to some different 
> table.``
> 
> I can't track why does sqlalchemy think that Activity would still have a 
> "strategic_project_name" column. I removed all the occurrencies of the word 
> "strategic_project_name" from my whole project, but I'm still getting this 
> error.
> 
> Do you have any advice on how to track this in the internals of sqlalchemy?

the internals of SQLAlchemy don't have this string name either. your best bet 
would be to turn on logging in the Postgresql server and see what it's seeing 
directly

https://www.postgresql.org/docs/9.0/runtime-config-logging.html




> 

> --
>  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/729b8817-a4e5-45ef-b31d-17772ab9016b%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/2e1a3e39-de7d-4e03-a8a2-a15169c0d899%40www.fastmail.com.


[sqlalchemy] Track a "column FOO does not exist" bug.

2019-09-05 Thread Steven James
Do you have a trigger or a constraint that references that column?

-- 
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/ae2db410-910e-4ae1-96ea-6255b2fb5c73%40googlegroups.com.


[sqlalchemy] Track a "column FOO does not exist" bug.

2019-09-05 Thread Riccardo Cagnasso
I have a table Activity that had a strategic_project_name column.
I removed the strategic_project_name column from the declarative definition 
of the Activity table and then the strategic_project_name column from the 
database itself.

Now I get this error message every time I try to update the one Activity 
record.

  File 
"/home/phas/virtualenvs/o35/lib/python3.5/site-packages/SQLAlchemy-1.3.8-py3.5-linux-x86_64.egg/sqlalchemy/engine/default.py"
, line 552, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column 
"strategic_project_name" does not exist

[SQL: UPDATE activity SET subtitle=%(subtitle)s WHERE activity.id = %(
activity_id)s]
[parameters: {'activity_id': 200, 'subtitle': 'gjh'}]

which is very odd because the SQL doesn't contain the column 
strategic_project_name

If I manually create a strategic_project_name column in the database 
activity table, it starts to work again, so it's not referring to some 
different table.

I can't track why does sqlalchemy think that Activity would still have a 
"strategic_project_name" column. I removed all the occurrencies of the word 
"strategic_project_name" from my whole project, but I'm still getting this 
error.

Do you have any advice on how to track this in the internals of sqlalchemy?

-- 
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/729b8817-a4e5-45ef-b31d-17772ab9016b%40googlegroups.com.