Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51804

RE: Best practice for connections and cursors

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Best practice for connections and cursors
Date 2013-08-02 13:10 +0000
References <719ac7ca4c274c4c884b809e5abd887c@exch.activenetwerx.com> <k70mv8t0lodtb23ti0ka6qv17fggb4ev5s@4ax.com> <CALwzid=+RaYmFa3bz-ne1VCxEgbc2Lamq4uAWH8E9=7RkXeT7A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.122.1375449150.1251.python-list@python.org> (permalink)

Show all headers | View raw


>Speaking to the OP:  personally, I don't like the approach of putting data access methods at the module level to >begin with.  I'd rather use a class.  Just because it makes sense to have a singleton connection now doesn't mean it >will always make sense as your application grows.
>In fact, the conflict you describe where one cursor is interfering with another cursor suggests that you may >already be at the point of needing multiple connections.  The operation that is creating a temp table and messing >things up should ideally be pulling an unused connection from a pool, so as to avoid potentially contaminating a >connection that may already be in use elsewhere in the code.

Appreciate the opinion, it would clean it up to go this route so I will. It turns out
the long delay was only a result of running the code through PyCharms debugger.

Thanks for the suggestion,
jlc

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: Best practice for connections and cursors "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-02 13:10 +0000

csiph-web