clickhouse-sqlalchemy icon indicating copy to clipboard operation
clickhouse-sqlalchemy copied to clipboard

Table name included in CRUD update while ClickHouse does not accept it

Open vkozmik opened this issue 6 months ago • 0 comments

I have a query which increments the column by one: query = ( update(Table) .filter(Table.id == '123') .values(counter=Table.counter + 1) ) session.connection().execute(query)

This issues ALTER TABLE table UPDATE counter = (table.counter + 1) and database complains about "table.counter"

This can be probably fixed by not including table name while calling _get_crud_params, but I do not know if it would have negative side effects for some updates which use select from multiple tables, etc. def visit_update(self, update_stmt, **kw): .... crud_params = crud._get_crud_params( self, update_stmt, compile_state, True, ==>>include_table=False<<==, **kw )

Version 0.3.0 with sqlalchemy 2.0.25

vkozmik avatar Jan 12 '24 11:01 vkozmik