Skip to content

Commit 3461181

Browse files
committed
Added schema option for asyncpg - closes #90
1 parent c431eb6 commit 3461181

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.4 (unreleased)
2+
3+
- Added `schema` option for asyncpg
4+
15
## 0.3.3 (2024-09-09)
26

37
- Improved support for cursor factories with Psycopg 2

pgvector/asyncpg/register.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from ..utils import Vector, HalfVector, SparseVector
22

33

4-
async def register_vector(conn):
4+
async def register_vector(conn, schema='public'):
55
await conn.set_type_codec(
66
'vector',
7+
schema=schema,
78
encoder=Vector._to_db_binary,
89
decoder=Vector._from_db_binary,
910
format='binary'
@@ -12,13 +13,15 @@ async def register_vector(conn):
1213
try:
1314
await conn.set_type_codec(
1415
'halfvec',
16+
schema=schema,
1517
encoder=HalfVector._to_db_binary,
1618
decoder=HalfVector._from_db_binary,
1719
format='binary'
1820
)
1921

2022
await conn.set_type_codec(
2123
'sparsevec',
24+
schema=schema,
2225
encoder=SparseVector._to_db_binary,
2326
decoder=SparseVector._from_db_binary,
2427
format='binary'

0 commit comments

Comments
 (0)