You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using an "UPDATE...FROM" in a CTE causes an error during compilation as of 1.4: TypeError: _compiler_dispatch() got multiple values for keyword argument 'asfrom'
update stmt:
UPDATE table_1 SET val=table_2.val FROM table_2 WHERE table_1.id = table_2.id RETURNING table_1.id, table_1.val
stmt w/cte:
WITH update_cte AS
(UPDATE table_1 SET val=table_2.val FROM table_2 WHERE table_1.id = table_2.id RETURNING table_1.id, table_1.val)
SELECT update_cte.id, update_cte.val
FROM update_cte
and running with 1.4.8:
update stmt:
UPDATE table_1 SET val=table_2.val FROM table_2 WHERE table_1.id = table_2.id RETURNING table_1.id, table_1.val
Traceback (most recent call last):
File "cte.py", line 27, in <module>
print("\nstmt w/cte:\n", qry.compile(engine))
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 506, in compile
return self._compiler(dialect, **kw)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 570, in _compiler
return dialect.statement_compiler(dialect, self, **kw)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 766, in __init__
Compiled.__init__(self, dialect, statement, **kwargs)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 455, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 490, in process
return obj._compiler_dispatch(self, **kwargs)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
return meth(self, **kw)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3098, in visit_select
text = self._compose_select_body(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3237, in _compose_select_body
[
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3238, in <listcomp>
f._compiler_dispatch(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
return meth(self, **kw)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 2564, in visit_cte
inner = cte.element._compiler_dispatch(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
return meth(self, **kw)
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3673, in visit_update
extra_from_text = self.update_from_clause(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/base.py", line 2423, in update_from_clause
return "FROM " + ", ".join(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/base.py", line 2424, in <genexpr>
t._compiler_dispatch(self, asfrom=True, fromhints=from_hints, **kw)
TypeError: _compiler_dispatch() got multiple values for keyword argument 'asfrom'
Stringifying the query without specifying a dialect gives a similar traceback, with the last two lines differing:
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3884, in update_from_clause
return "FROM " + ", ".join(
File "/home/dblue/sqla/envl/lib/python3.8/site-packages/sqlalchemy/sql/compiler.py", line 3885, in <genexpr>
t._compiler_dispatch(self, asfrom=True, fromhints=from_hints, **kw)
TypeError: _compiler_dispatch() got multiple values for keyword argument 'asfrom'
Tested with python 3.9 on macOS and python 3.8 on linux.
The text was updated successfully, but these errors were encountered:
Using an "UPDATE...FROM" in a CTE causes an error during compilation as of 1.4:
TypeError: _compiler_dispatch() got multiple values for keyword argument 'asfrom'
Running with 1.3.24:
and running with 1.4.8:
Stringifying the query without specifying a dialect gives a similar traceback, with the last two lines differing:
Tested with python 3.9 on macOS and python 3.8 on linux.
The text was updated successfully, but these errors were encountered: