Ok, thanks! For now, I guess setting self._returning is a reasonable
workaround?

Le lun. 28 mai 2018 à 15:13, Mike Bayer <[email protected]> a écrit :

> I've added
> https://bitbucket.org/zzzeek/sqlalchemy/issues/4267/explain-example-is-not-working-w-crud
> to look at this at some point.
>
> On Mon, May 28, 2018 at 3:01 PM, Charles Langlois <[email protected]>
> wrote:
>
>> Yes, that is the case, sorry for the lack of context.
>>
>> Example:
>>
>> query = delete(MyMapper.__table__).where(MyMapper.my_column == value)
>> result = session.execute(explain(query)) # exception occurs
>>
>>
>> Le lun. 28 mai 2018 à 12:09, Mike Bayer <[email protected]> a
>> écrit :
>>
>>> I would assume you're putting an insert(), update() , or delete() into
>>> the explain() ?   that codepath wouldn't be called otherwise, or if
>>> you can show me exactly how to reproduce we can update the recipe.
>>> thanks!
>>>
>>> On Mon, May 28, 2018 at 11:51 AM, Charles Langlois
>>> <[email protected]> wrote:
>>> > Following the recipe to create an 'explain' clause element on the
>>> bitbucket
>>> > repository, trying to execute a query using `explain` result in an
>>> attribute
>>> > error:
>>> >
>>> > 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'
>>> >
>>> > Adding 'self._returning = False' in the __init__ of explain solves the
>>> > issue. Maybe something is missing in the documentation?
>>> >
>>> > --
>>> > 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 [email protected].
>>> > To post to this group, send email to [email protected].
>>> > Visit this group at https://groups.google.com/group/sqlalchemy.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> 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 a topic in the
>>> Google Groups "sqlalchemy" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/sqlalchemy/XtY8K3O_d68/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/sqlalchemy.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> *Charles Langlois*
>>
>> *     Programmeur-analyste - Programmer Analyst*
>>
>>
>> www.konversion.ca
>> <http://www.konversion.ca/?utm_source=emailsignature&utm_medium=email&utm_content=vous-etes-pas-de-taille-from-jl&utm_campaign=konversion-email>
>>
>>
>> <http://www.konversion.ca/?utm_source=emailsignature&utm_medium=email&utm_content=vous-etes-pas-de-taille-from-jl&utm_campaign=konversion-email>
>> 5605 avenue de Gaspé
>> <https://maps.google.com/?q=5605+avenue+de+Gasp%C3%A9&entry=gmail&source=g>,
>> Suite 902
>> <https://maps.google.com/?q=5605+avenue+de+Gasp%C3%A9+,+Suite+902+Montr%C3%A9al,+QC,+Canada+-+H2T+2A4&entry=gmail&source=g>
>> Montréal, QC, Canada - H2T 2A4
>> <https://maps.google.com/?q=5605+avenue+de+Gasp%C3%A9+,+Suite+902+Montr%C3%A9al,+QC,+Canada+-+H2T+2A4&entry=gmail&source=g>
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 a topic in the
> Google Groups "sqlalchemy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sqlalchemy/XtY8K3O_d68/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
*Charles Langlois*

*     Programmeur-analyste - Programmer Analyst*


www.konversion.ca
<http://www.konversion.ca/?utm_source=emailsignature&utm_medium=email&utm_content=vous-etes-pas-de-taille-from-jl&utm_campaign=konversion-email>

<http://www.konversion.ca/?utm_source=emailsignature&utm_medium=email&utm_content=vous-etes-pas-de-taille-from-jl&utm_campaign=konversion-email>
5605 avenue de Gaspé
<https://maps.google.com/?q=5605+avenue+de+Gasp%C3%A9&entry=gmail&source=g>,
Suite 902
Montréal, QC, Canada - H2T 2A4

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to