Initial implementation of pgvector and Oracle 26ai vector search demo
Three FastAPI backends comparing PostgreSQL/pgvector and Oracle 26ai for semantic image search using CLIP embeddings: Python-side embedding for both databases, plus Oracle in-database embedding via VECTOR_EMBEDDING(CLIP_TXT). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import oracledb
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
def get_connection():
|
||||
return oracledb.connect(
|
||||
user=os.getenv("ORA_USER"),
|
||||
password=os.getenv("ORA_PASSWORD"),
|
||||
dsn=f"{os.getenv('ORA_HOST')}:{os.getenv('ORA_PORT')}/{os.getenv('ORA_SERVICE')}",
|
||||
)
|
||||
|
||||
def get_connection_indb():
|
||||
return oracledb.connect(
|
||||
user=os.getenv("ORA_USER_INDB"),
|
||||
password=os.getenv("ORA_PASSWORD_INDB"),
|
||||
dsn=f"{os.getenv('ORA_HOST')}:{os.getenv('ORA_PORT')}/{os.getenv('ORA_SERVICE')}",
|
||||
)
|
||||
Reference in New Issue
Block a user