<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu" -->

---
title: PostgreSQL adapter for Python | daily.dev
description: Psycopg2 2.7.2 has shipped, fixing a wide range of bugs accumulated over the previous few months. Highlights include fixing an inconsistent state in externally...
canonical: https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PostgreSQL adapter for Python | daily.dev
og:description: Psycopg2 2.7.2 has shipped, fixing a wide range of bugs accumulated over the previous few months. Highlights include fixing an inconsistent state in externally...
og:url: https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu
og:image: https://api.daily.dev/og/posts/2RwLEnBWU.png
og:image:alt: PostgreSQL adapter for Python
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL adapter for Python

**[Psycopg](https://daily.dev/sources/psycopg)** · 2 min read · 0 upvotes · 0 comments

## Summary

Psycopg2 2.7.2 has shipped, fixing a wide range of bugs accumulated over the previous few months. Highlights include fixing an inconsistent state in externally closed connections (a regression that had been fixed in 2.6.2 but missed in 2.7), correcting Python exception propagation in green callbacks, hiding passwords from connection.dsn when using URI connection strings, fixing a segfault in lobject() and its lobject_factory keyword, correcting ReplicationCursor.consume_stream()'s keepalive_interval argument, parsing Redshift interval microseconds, dropping the VC9 runtime dependency on Windows binaries, and updating error codes to match PostgreSQL 10 beta 1. The package is available on PyPI.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.psycopg.org/articles/2017/07/22/psycopg-272-released>

## Questions this post answers

### What bugs were fixed in psycopg2 2.7.2?

Psycopg2 2.7.2 fixed an inconsistent state bug in externally closed connections that had been patched in 2.6.2 but was accidentally left out of the 2.7 line, corrected Python exception propagation in green callbacks, hid passwords from connection.dsn when using URI-style connection strings, fixed a segfault in lobject() when mode=None, and fixed the lobject_factory keyword argument.

_Track psycopg2 release notes like these on daily.dev before upgrading a production database driver._

### Does psycopg2 2.7.2 support PostgreSQL 10 beta 1 error codes?

Yes, psycopg2 2.7.2 updated its errorcodes map to match PostgreSQL 10 beta 1, alongside fixes for ReplicationCursor.consume_stream()'s keepalive_interval argument and support for sql.Composable objects in start_replication_expert(). It also dropped the VC9 runtime dependency from Windows binary packages.

_Developers syncing driver versions with PostgreSQL betas can follow updates like this on daily.dev._

---

Tags: [#python](https://daily.dev/tags/python), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"PostgreSQL adapter for Python","url":"https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu"},"datePublished":"2026-08-23T12:22:17.334Z","dateModified":"2026-08-23T12:46:57.922Z","description":"Psycopg2 2.7.2 has shipped, fixing a wide range of bugs accumulated over the previous few months. Highlights include fixing an inconsistent state in externally...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b0cbd2ac8948f96ab39fa6a90db7464f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b0cbd2ac8948f96ab39fa6a90db7464f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Psycopg","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Psycopg","logo":"https://media.daily.dev/image/upload/s--5N-KNNWk--/f_auto,q_auto/v1787487485/logos/psycopg?_a=BAMAMicg0","url":"https://daily.dev/sources/psycopg"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,postgresql","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Psycopg","item":"https://daily.dev/sources/psycopg"},{"@type":"ListItem","position":3,"name":"PostgreSQL adapter for Python"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/postgresql-adapter-for-python-2rwlenbwu#faq","mainEntity":[{"@type":"Question","name":"What bugs were fixed in psycopg2 2.7.2?","acceptedAnswer":{"@type":"Answer","text":"Psycopg2 2.7.2 fixed an inconsistent state bug in externally closed connections that had been patched in 2.6.2 but was accidentally left out of the 2.7 line, corrected Python exception propagation in green callbacks, hid passwords from connection.dsn when using URI-style connection strings, fixed a segfault in lobject() when mode=None, and fixed the lobject_factory keyword argument. Track psycopg2 release notes like these on daily.dev before upgrading a production database driver."}},{"@type":"Question","name":"Does psycopg2 2.7.2 support PostgreSQL 10 beta 1 error codes?","acceptedAnswer":{"@type":"Answer","text":"Yes, psycopg2 2.7.2 updated its errorcodes map to match PostgreSQL 10 beta 1, alongside fixes for ReplicationCursor.consume_stream()'s keepalive_interval argument and support for sql.Composable objects in start_replication_expert(). It also dropped the VC9 runtime dependency from Windows binary packages. Developers syncing driver versions with PostgreSQL betas can follow updates like this on daily.dev."}}]}
```

