The profiler results are in but they do not tell me anything that I did not already find by manually stepping through the code. See my first post, above. The method that takes all the time is `execute` of `cx_Oracle.Cursor` itself. I cannot step into that because that is some C-call.
I did however spend some time on discerning the differences between executing a plain text statement vs. a query object. The main difference appeared to be the `pre_exec` method in the cx_Oracle dialect that only gets called for query objects but not for plain text. And Heureka! It is the call to `self.set_input_sizes` (line 629 in cx_oracle.py in SQLAlchemy 1.2.19). While the call itself is inconspicuous, it causes the huge delay when calling `execute` on the cursor later down the line. If I delete this call, my code works fine for both, the plain text and the query object. However, comparing this to SQLAlchemy 1.3.0 (the first version to not have the problem) does not really point me to a solution of the puzzle: Version 1.3.0 has the same call to `self.set_input_sizes` and it gets called with the same parameters. Thus, I am back to square 1: I know that setting the input sizes somehow screws up the cursor execution but this is not the root cause.I notice that fixes to `setinputsizes` show up several times in the links that you provided. Thus, I assume that I stumbled on one of those problems, though I cannot tell exactly which one of those. Still, upgrading to 1.3.x solves my problem. Thanks for all the help! -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/28389615-4154-45cc-aa3f-03339485ef8a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.