Skip to content

Feature/a1 db explorer#216

Merged
seyoung4503 merged 9 commits intomasterfrom
feature/A1-db-explorer
Mar 2, 2026
Merged

Feature/a1 db explorer#216
seyoung4503 merged 9 commits intomasterfrom
feature/A1-db-explorer

Conversation

@seyoung4503
Copy link
Collaborator

#️⃣ Issue Number

  • TBD

📝 요약(Summary)

  • Agent가 DB를 직접 탐색할 수 있도록 DBExplorerPort Protocol과 SQLAlchemyExplorer 구현체를
    추가했습니다.
  • build_explorer_from_url 편의 함수로 URL 하나만으로 Explorer를 생성할 수 있으며, PEP 562 lazy
    import로 기존 FAISS INFO 로그 출력 문제도 함께 수정했습니다.
  • VectorRetrieversave() / load() persistence를 추가해 FAISS 인덱스를 파일로 저장·복원할 수
    있습니다.

💬 To Reviewers (선택)

  • execute_read_only의 이중 방어 로직 (prefix guard + rollback-always) 이 충분한지 검토 부탁드립니다.
  • SQLite는 sqlite_master에서 원본 DDL을 반환하고, 그 외 dialect는 CreateTable.compile()
    재구성합니다. dialect별 DDL 품질 차이가 있을 수 있어 확인 부탁드립니다.

PR Checklist

  • DBExplorerPortlist_tables / get_ddl / sample_data / execute_read_only 4개 메서드
    Protocol 정의
  • SQLAlchemyExplorer 구현 및 from_engine() classmethod로 기존 engine 공유 지원
  • build_explorer_from_url factory 함수 추가 (schema 파라미터로 범위 지정 가능)
  • __init__.py lazy import 전환 (PEP 562) — baseline flow FAISS INFO 로그 문제 수정 포함
  • SQLAlchemyExplorer 통합 테스트 12케이스 (write 거부, from_engine 공유, SQLAlchemyDB 동시 사용 등)
  • 튜토리얼 문서에 DB explorer 사용 예시 추가
  • VectorRetriever.save() / load() FAISS persistence 추가 및 테스트 3케이스

  Agent가 DB를 직접 탐색할 때 사용하는 4개 메서드 정의.
  list_tables / get_ddl / sample_data / execute_read_only.
  DDL에 이미 있는 정보는 별도 메서드 없음, 관계 추론은 LLM에 위임.
  SQLite는 sqlite_master에서 원본 DDL 그대로 반환.
  그 외 dialect는 CreateTable.compile()으로 FK/PK 포함 DDL 생성.
  execute_read_only는 prefix guard + rollback-always 이중 방어.
  from_engine() classmethod로 기존 SQLAlchemyDB engine 공유 가능.
  DB URL 하나로 SQLAlchemyExplorer 생성하는 편의 함수.
  schema 파라미터로 특정 스키마 범위 지정 가능.
  PEP 562 __getattr__ lazy import 적용.
  FAISSVectorStore, PGVectorStore, DataHubCatalogLoader를 lazy 전환해
  baseline flow 실행 시 FAISS INFO 로그 출력 문제 함께 수정.
  list_tables / get_ddl / sample_data / execute_read_only 전체 검증.
  write 거부(INSERT, DROP), from_engine 공유, SQLAlchemyDB 동시 사용 포함.
  SQLite in-memory DB 사용, 외부 의존 없음.
  build_explorer_from_url 기본 사용, 전체 테이블 루프,
  PostgreSQL/MySQL 연결, from_engine 재사용, 쓰기 거부 예시 추가.
  Add VectorRetriever.save() and VectorRetriever.load() for FAISS-backed
  file persistence. save() writes the vector index and a .registry JSON
  sidecar; load() restores both. InMemoryVectorStore raises
  NotImplementedError. Add 3 tests (save/load roundtrip, registry
  integrity, InMemory raises).
  Accept vectorstore: VectorStorePort as a parameter instead of
  instantiating FAISSVectorStore internally. components/ no longer
  imports from integrations/. Store restoration is the caller's
  responsibility.
@seyoung4503 seyoung4503 merged commit 6a7151d into master Mar 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant