[Yum-devel] [PATCH] Support newer pysqlite for yum proper

Jeremy Katz katzj at redhat.com
Wed Oct 25 19:49:28 UTC 2006


And here's the biggest chunk needed for python2.5 and/or the newer
pysqlite support.

The big change with the newer version of pysqlite is that it actually
follows the python DB-API[1].  This means that (by default) rows are
just returned as tuples.  Luckily, it's easy to make it so that we can
get back dict-like rows.  So half of the changes here are going from
something like row.name -> row["name"].

The other (and more annoying) change is that pysqlite now uses qmark
instead of pyformat for escaping in queries.  Which means that to
support both we either have to
  a) do a conversion on the fly
  b) maintain two copies of the code
Since b seems like it would be a maintenance nitemare, I've gone for a.
First, I converted everything to qmark style (this uses ? instead of %s
for parameters) and then have imported a chunk of Wichert Akkerman's
python-dhm so that we can convert on the fly to pyformat style escaping.

While ugly, it seems to work and I've done some very basic smoke testing
with both python 2.5 and python 2.4 and things seem to be fine with
both.  More testing is definitely needed, though.

Other thoughts or opinions on ways to go about this?  I'm more than open
to listening because I really don't like this as it stands :-/  

Jeremy

[1] http://www.python.org/dev/peps/pep-0249/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yum-pysqlite.patch
Type: text/x-patch
Size: 27845 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20061025/772ba999/attachment.bin 


More information about the Yum-devel mailing list