[Sqlalchemy-tickets] Issue #4267: explain example is not working w/ crud (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2018-05-28 19:13:22
|
New issue 4267: explain example is not working w/ crud https://bitbucket.org/zzzeek/sqlalchemy/issues/4267/explain-example-is-not-working-w-crud Michael Bayer: I'm not following exactly how this happens: given https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/Explain ``` #!python query = delete(MyMapper.__table__).where(MyMapper.my_column == value) result = session.execute(explain(query)) # exception occurs ``` is said by user to produce: ``` #!python SubTest error: Traceback (most recent call last): File "/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor yield File "/usr/lib/python3.6/unittest/case.py", line 523, in subTest yield File "/home/charles/PycharmProjects/my_project/models.py", line 39, in test_delete_cascade result = self.session.execute(explain_query).fetchall() File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 1170, in execute bind, close_with_result=True).execute(clause, params or {}) File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute return meth(self, multiparams, params) File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement if not self.schema_for_object.is_default else None) File "<string>", line 1, in <lambda> File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 442, in compile return self._compiler(dialect, bind=bind, **kw) File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 448, in _compiler return dialect.statement_compiler(dialect, self, **kw) File "/home/charles/PycharmProjects/my_project/.env/lib/python3.6/site-packages/sqlalchemy/sql/compiler.py", line 457, in __init__ ) and statement._returning: AttributeError: 'explain' object has no attribute '_returning' ``` i'm not following how .isinsert/.isdelete/.isupdate is getting set in the first place. also if these affect the compilation they should be taken into account by the recipe (can add recipe to the tests). |