On Friday 03 June 2016 09:07 PM, Jonathan Vanasco wrote:
On Friday, June 3, 2016 at 7:49:23 AM UTC-4, Krishnakant wrote:
So it will have no performance difference is it?
If both do same thing then how and why will explicit connection
help me
better?
the `engine.execute()` will be slower, because you will be
creating/checking-out a different connection for each operation in the
for-loop and (needlessly) leveraging the sqlalchemy connection pool.
if you use `connection.execute()` with a single connection, then you
don't have as much overhead involved with the connection pool management.
Your errors are probably from improperly implementing the connection
pool. I suggest re-reading the connection pool docs and faq to get a
better understanding of what it does and why it does that.
Thank you Jonathan,
I had guessed about your reply, and it came out correct.
So essentially opening a connection at the start of a class method/
function, doing number of queries and then closing it just before return
would be the right strategy I think?
And is there some kind of cashing available for sql expression as well?
I see a lot of articles on things like memcash etc but they all talk
about ORM.
Happy hacking.
Krishnakant.
--
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.