Implement PostgreSQL + FAISS Hybrid Storage for Secure PII Management #38#42
Open
massoudsh wants to merge 1 commit intopooyaphoenix:mainfrom
Open
Implement PostgreSQL + FAISS Hybrid Storage for Secure PII Management #38#42massoudsh wants to merge 1 commit intopooyaphoenix:mainfrom
massoudsh wants to merge 1 commit intopooyaphoenix:mainfrom
Conversation
- Add Postgres service and schema (pii_records, documents, query_logs) - Encrypt passage text with Fernet; store in Postgres, FAISS for vectors only - RetrieverAgent: optional PG meta load/save when USE_PG_STORAGE=true - Audit logging: query_logs for every /query when PG enabled - Migration script: migrate_pickle_to_pg.py - Backward compatible: no PG = existing pickle behavior Closes pooyaphoenix#38 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the PostgreSQL + FAISS hybrid described in #38: PII is stored encrypted in PostgreSQL, FAISS is used only for vector search (no PII). Backward compatible: without
DATABASE_URL/USE_PG_STORAGE, behavior is unchanged (pickle only).Closes #38
What’s included
docker-composeservice, schema (pii_records,documents,query_logs), init scriptENCRYPTION_KEYquery_logsUSE_PG_STORAGE=true, meta load/save uses Postgres; FAISS unchanged; fallback to pickle if PG empty or unavailable/querylogs toquery_logswhen PG is enabledscripts/migrate_pickle_to_pg.pyto copy existing pickle data into Postgres (encrypted)DATABASE_URL,ENCRYPTION_KEYQuestion for maintainer
Is the hybrid (FAISS + Postgres) what you want, or would you prefer a full move to PostgreSQL?
If you’d rather go full Postgres (e.g. pgvector), we can treat this as a stepping stone and plan a follow-up that migrates vectors into Postgres and removes FAISS. Happy to adjust direction based on your preference.
Made with Cursor