I am extremely excited to announce the first stable release of Psycopg 3!
We are immensely proud to release on PyPI the first beta package of Psycopg 3!
One of the goals of the Psycopg 3 project is to make easy to port code developed from Psycopg 2. For this reason the creation of a Django backend (the module you specify in the settings as your database ENGINE) was a project with a double goal:
- A Django driver is a way to make Psycopg 3 useful from the start, with the possibility of dropping it in a project transparently and have available, when needed the new features offered (for instance the superior COPY support).
- The difficulty of introducing Psycopg 3 in the Django codebase and the type of changes required are indicative of the type of problems that could be found porting other projects.
...and it's done! A few days ago, the new Psycopg 3 Django backend could pass the entire Django test suite!
Psycopg 2.9 has been released!
This is a relatively small release compared to previous major releases. However the creation of the packages took a lot of effort. The previously used CI system now has reduced support for free software projects - it was decided that package building should be moved to GitHub Actions.
Packaging has also become more complex because of the evolution of the Python packaging standards and the need to support multiple architectures (Intel, ARM, PPC...).
Maintaining a project such as Psycopg requires a lot of effort. For this reason, we are extremely grateful to all our sponsors who are enabling the maintenance and development of Psycopg. Thank you very much!
The psycopg2 pool is a pretty simple object, little more than... a pool of open connections, and I think it falls short in several ways:
- the top usability problem is the fact that it cannot be used as context manager;
- if a connection is broken it is not noticed it until it is used by a client;
- if minconn connections are already taken, a new one is created and disposed of as soon as finished using, regardless of whether other clients may need it;
- if more than maxconn connections are requested the client will receive an error.
For psycopg3 I would like something better. I have read around, looking into other pool implementations to figure out what a well designed connection pool ought to do (a very well thought one seems the Java HikariCP) and these are a few ideas I'd like to work on: they are here for a feedback, before I jump into enthusiastically implementing the wrong thing...
The adaptation system between Python objects and PostgreSQL types is at the core of psycopg2 and psycopg3. The flexibility of the psycopg2 adaptation system provides good out-of-the-box object mapping and allows users to customise it to suit any need. Do you want your decimal numbers returned as float because you need speed over pennies? Do you want to map PostgreSQL Infinity dates to the 25th of December 3099? That's certainly doable.
The psycopg3 adaptation system needs some modification compared to psycopg2, because psycopg3 uses the "extended query protocol" to send query parameters separately from the query. Together, with the differences to accommodate, there is also a chance to improve a system that has been in use for several years and has shown its shortcomings together with its strengths.
psycopg2 allows interaction with PostgreSQL COPY commands. However what is possible to do with them is relatively limited: the only possible interaction is with file-like objects:
- there is no adaptation from Python objects to PostgreSQL, as there is for normal queries: data must be formatted "manually" by the user;
- psycopg2 "pulls" data from the file: writing a system that produces data and pushes it into PostgreSQL is a very contrived operation, requiring to write a blocking file-like object;
- there is no support for asynchronous copy.
psycopg3 addresses these shortcomings and makes it easy to write Python programs producing data and pushing it efficiently to the database using the COPY protocol.
Psycopg 2.8.6 has been released.
Psycopg 2.8.5 has been released.
This release adds support for AIX and brings a few bug fixes.
Psycopg 2.8.4 has been released.
The release brings a few assorted bugfixes and adds support for Python 3.8 and PostgreSQL 12.