Skip to content

Commit

Permalink
Merge pull request #117 from Azure-Samples/pgdemo
Browse files Browse the repository at this point in the history
Fix for vector extension order
  • Loading branch information
pamelafox authored Oct 23, 2024
2 parents cdb1f28 + 3f4674c commit 8227c72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.envFile": "",
"files.exclude": {
".ruff_cache": true,
".pytest_cache": true,
Expand Down
5 changes: 4 additions & 1 deletion src/backend/fastapi_app/postgres_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def get_password_from_azure_credential():
@event.listens_for(engine.sync_engine, "connect")
def register_custom_types(dbapi_connection: AdaptedConnection, *args):
logger.info("Registering pgvector extension...")
dbapi_connection.run_async(register_vector)
try:
dbapi_connection.run_async(register_vector)
except ValueError:
logger.warning("Could not register pgvector data type yet as vector extension has not been CREATEd")

@event.listens_for(engine.sync_engine, "do_connect")
def update_password_token(dialect, conn_rec, cargs, cparams):
Expand Down

0 comments on commit 8227c72

Please sign in to comment.