[ANN] pysqlite 2.4.0 released

Gerhard Häring gh at ghaering.de
Sun Nov 25 20:24:24 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

pysqlite 2.4.0 released
=======================

I'm pleased to announce the availability of pysqlite 2.4.0. This is
a release with major new features.

Go to http://pysqlite.org/ for downloads, online documentation and
reporting bugs.

What is pysqlite?

     pysqlite is a DB-API 2.0-compliant database interface for SQLite.

     SQLite is a in-process library that implements a self-contained,
     serverless, zero-configuration, transactional SQL database
     engine.

     pysqlite makes this powerful embedded SQL engine available to
     Python programmers. It stays compatible with the Python database
     API specification 2.0 as much as possible, but also exposes most
     of SQLite's native API, so that it is for example possible to
     create user-defined SQL functions and aggregates in Python.

     If you need a relational database for your applications, or even
     small tools or helper scripts, pysqlite is often a good fit. It's
     easy to use, easy to deploy, and does not depend on any other
     Python libraries or platform libraries, except SQLite. SQLite
     itself is ported to most platforms you'd ever care about.

     It's often a good alternative to MySQL, the Microsoft JET engine
     or the MSDE, without having any of their license and deployment
     issues.

pysqlite can be downloaded from http://pysqlite.org/ - Sources and
Windows binaries for Python 2.5, 2.4 and Python 2.3 are available.

=======
CHANGES
=======

- - Implemented context managers. pysqlite's connections can now be used as
  context managers with Python 2.5 or later:

        from __future__ import with_statement
        from pysqlite2 import dbapi2 as sqlite

        con = sqlite.connect(":memory:")
        con.execute("create table person (id integer primary key, firstname varchar unique)")

        # Successful, con.commit() is called automatically afterwards
        with con:
            con.execute("insert into person(firstname) values (?)", ("Joe",))

        # con.rollback() is called after the with block finishes with an exception, the
        # exception is still raised and must be catched
        try:
            with con:
                con.execute("insert into person(firstname) values (?)", ("Joe",))
        except sqlite.IntegrityError:
            print "couldn't add Joe twice"

- - pysqlite connections can now be created from APSW connections. This enables
  users to use APSW functionality in applications using the DB-API from
  pysqlite:

        from pysqlite2 import dbapi2 as sqlite
        import apsw

        apsw_con = apsw.Connection(":memory:")
        apsw_con.createscalarfunction("times_two", lambda x: 2*x, 1)

        # Create pysqlite connection from APSW connection
        con = sqlite.connect(apsw_con)
        result = con.execute("select times_two(15)").fetchone()[0]
        assert result == 30
        con.close()

  Caveat: This will only work if both pysqlite and APSW are dynamically
  linked against the same SQLite shared library. Otherwise you will
  experience a segfault.

- - Fixed shuffled docstrings for fetchXXX methods.

- - Workaround for SQLite 3.5.x versions which apparently return NULL for
  "no-operation" statements.

- - Disable the test for rollback detection on old SQLite versions. This prevents
  test failures on systems that ship outdated SQLite libraries like MacOS X.


- - Implemented set_progress_handler for progress callbacks from SQLite. This is
  particularly useful to update GUIs during long-running queries.  Thanks to
  exarkun for the original patch.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHScvodIO4ozGCH14RAoFkAJ4uQc5hW83jhD9D30FbjeYvMRjvKwCdEq/y
MmWmjLU7eFpLprVQRZpp2OQ=
=caM6
-----END PGP SIGNATURE-----



More information about the Python-list mailing list