is that session using "autocommit" mode?   it looks like the error is
raised on the UNLOCK ?



On Wed, Dec 6, 2017 at 12:24 AM,  <jens.troe...@gmail.com> wrote:
> Once again I'm at a loss.
>
> I tried this:
>
>     dbsession.execute("LOCK TABLES tokens WRITE")
>     dbsession.execute(cond_insert) # As per above discussion.
>     dbsession.execute("UNLOCK TABLES")
>
> which raises an error: 1100, "Table 'tokens' was not locked with LOCK
> TABLES".
>
> Then I read that the temporary table created by an inner select needs to be
> locked as well, but it doesn't exist at the time when LOCK TABLES executes.
> So using stmt.alias("foo") for the INSERT, and adding "foo" to the LOCK
> TABLES doesn't work. The "dual" table can't be locked either, as it doesn't
> actually exist. No other table is being used by the conditional INSERT as
> far as I can see.
>
> I can't quite make sense of the error message, and how to resolve it.
>
> --
> 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 post to this group, send email to sqlalchemy@googlegroups.com.
> 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 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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to