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

---
title: PostgreSQL adapter for Python | daily.dev
description: A beta release of Psycopg, the popular PostgreSQL adapter for Python, adds Python 3 support for the first time, along with a register_composite() function for...
canonical: https://daily.dev/posts/postgresql-adapter-for-python-jfpzn8imf
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: A beta release of Psycopg, the popular PostgreSQL adapter for Python, adds Python 3 support for the first time, along with a register_composite() function for...
og:url: https://daily.dev/posts/postgresql-adapter-for-python-jfpzn8imf
og:image: https://api.daily.dev/og/posts/JfPZN8Imf.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

A beta release of Psycopg, the popular PostgreSQL adapter for Python, adds Python 3 support for the first time, along with a register_composite() function for casting PostgreSQL composite types into Python tuples/namedtuples, more efficient iteration on named cursors, weakly referenceable connections and cursors, new large object modes for bytes/unicode handling, and additional encoding mappings. Several bug fixes address reference leaks, a segfault when closing large objects, adaptation of None in composite types, and a missing icon in the ZPsycopgDA package for Zope.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.psycopg.org/articles/2011/02/06/psycopg-24-beta1-released>

## Questions this post answers

### Does Psycopg 2.4 support Python 3?

Yes, Psycopg 2.4 beta1 is the first version of the PostgreSQL adapter for Python to support Python 3. Alongside this, it adds a register_composite() function to cast PostgreSQL composite types into Python tuples or namedtuples, more efficient iteration on named cursors, and weakly referenceable connections and cursors.

_Teams planning a Python 3 migration can track driver compatibility updates like this on daily.dev._

### How do I handle both bytes and unicode when reading or writing PostgreSQL large objects in Psycopg?

Psycopg 2.4 beta1 adds 'b' and 't' modes to large objects: write can accept either bytes strings or unicode, and read can return either bytes strings or decoded unicode, giving explicit control over the text/binary handling of large object data.

_Developers debugging PostgreSQL text encoding issues can follow driver-level fixes 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-jfpzn8imf)

```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-jfpzn8imf","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/postgresql-adapter-for-python-jfpzn8imf"},"datePublished":"2026-08-23T12:21:54.485Z","dateModified":"2026-08-23T12:44:27.937Z","description":"A beta release of Psycopg, the popular PostgreSQL adapter for Python, adds Python 3 support for the first time, along with a register_composite() function for...","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-jfpzn8imf","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-jfpzn8imf#faq","mainEntity":[{"@type":"Question","name":"Does Psycopg 2.4 support Python 3?","acceptedAnswer":{"@type":"Answer","text":"Yes, Psycopg 2.4 beta1 is the first version of the PostgreSQL adapter for Python to support Python 3. Alongside this, it adds a register_composite() function to cast PostgreSQL composite types into Python tuples or namedtuples, more efficient iteration on named cursors, and weakly referenceable connections and cursors. Teams planning a Python 3 migration can track driver compatibility updates like this on daily.dev."}},{"@type":"Question","name":"How do I handle both bytes and unicode when reading or writing PostgreSQL large objects in Psycopg?","acceptedAnswer":{"@type":"Answer","text":"Psycopg 2.4 beta1 adds 'b' and 't' modes to large objects: write can accept either bytes strings or unicode, and read can return either bytes strings or decoded unicode, giving explicit control over the text/binary handling of large object data. Developers debugging PostgreSQL text encoding issues can follow driver-level fixes like this on daily.dev."}}]}
```

