Skip to content

Added support for Bit objects with Psycopg 2 and pg8000 - #170

Open
astroknot-sheep wants to merge 1 commit into
pgvector:masterfrom
astroknot-sheep:bit-adapters-psycopg2-pg8000
Open

astroknot-sheep wants to merge 1 commit into
pgvector:masterfrom
astroknot-sheep:bit-adapters-psycopg2-pg8000

Conversation

@astroknot-sheep

Copy link
Copy Markdown

Fixes #169

Bit objects can be passed as query parameters with Psycopg 3, but not with Psycopg 2 or pg8000. This adds:

  • pgvector/psycopg2/bit.py with a BitAdapter, matching HalfvecAdapter / SparsevecAdapter, registered in register_vector
  • a Bit out adapter for pg8000 using to_text(), alongside the existing Vector one

asyncpg is unchanged (asyncpg.BitString per #110).

Tests: test_bit_class for Psycopg 2 and pg8000 (both fail on master). Full suite passes locally (527 passed, Postgres 17), plus mypy and ty check.

Written with AI assistance; I have reviewed and tested the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bit objects not supported with Psycopg 2 and pg8000

1 participant