refactor(postgres-adapter): relocate api/ → cli/api/ + update imports (Phase 2) - #5
Closed
ihistand wants to merge 1 commit into
Closed
refactor(postgres-adapter): relocate api/ → cli/api/ + update imports (Phase 2)#5ihistand wants to merge 1 commit into
ihistand wants to merge 1 commit into
Conversation
… (Phase 2) Phase 2 of `adapter/postgres-first-class` per docs/postgres_first_class_design.md (Phases 1-2 inherited verbatim from docs/postgres_reintegration_assessment.md). Moves the restored Postgres adapter files into the modern Dataform/sqlanvil CLI layout: api/dbadapters/postgres.ts → cli/api/dbadapters/postgres.ts api/utils/postgres.ts → cli/api/utils/postgres.ts Updated imports (mechanical) to point at the current `cli/api/...` modules: sa/api/commands/credentials → sa/cli/api/commands/credentials sa/api/dbadapters/index → sa/cli/api/dbadapters/index sa/api/utils/postgres → sa/cli/api/utils/postgres sa/api/utils/results → sa/cli/api/utils/results sa/core/adapters → sa/cli/api/dbadapters/execution_sql Also dropped the (now-broken) imports for symbols that were deleted upstream when non-BQ warehouses were removed: sa/api/ssh_tunnel_proxy — gone, deleted via commit b4d2b2f sa/api/utils/error_parsing — gone (parseRedshiftEvalError) The file still references `SSHTunnelProxy` and `parseRedshiftEvalError` in the body; that's fine — file is **excluded from the BUILD glob** in both `cli/api/BUILD` and `cli/api/utils/BUILD` until Phase 3 does the proper interface alignment (executeRaw, deleteTable, schemas signature, sqlanvil.IJDBC → new PostgresConnection proto, SSH removal, error formatter swap). Verified: ./scripts/docker-bazel build //... → 139 targets, success Empty root-level api/ directory removed. Next: Phase 3a — implement IDbAdapter against the relocated file.
This was referenced May 27, 2026
ihistand
added a commit
that referenced
this pull request
Jun 4, 2026
…(no hardcode) #4: The two index_compile_test cases that npm-install specific @sqlanvil/core versions (2.9.0, 3.0.50) from the public registry can't pass until those are published (only 0.0.1 placeholders exist). Gate them behind SA_TEST_PUBLISHED_CORE so //cli:tests is green by default; opt in once published. #5: DEFAULT_DATABASE was a hardcoded "sqlanvil" working edit. Make index_test_base derive the project from test_credentials/bigquery.json's projectId (same source tests/integration/utils.ts uses), overridable via SA_TEST_BIGQUERY_PROJECT, with a placeholder fallback. No hardcoded project committed; no machine-specific working edits. The bigquery_project/workflow_settings.yaml `defaultProject` placeholder is left as-is (the integration specs override it from the creds projectId). Verified: //cli:index_compile_test passes (2 gated tests skipped), //cli:index_run_e2e_test passes against live BigQuery (project from creds). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded: the Postgres reintegration + Dataform→SQLAnvil rename landed on |
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
Phase 2 of `adapter/postgres-first-class` per `docs/postgres_first_class_design.md` — Phases 1-2 are inherited verbatim from `docs/postgres_reintegration_assessment.md`.
Moves the restored Postgres adapter files into the modern Dataform/sqlanvil CLI layout:
Empty root-level `api/` directory removed.
Import path updates (mechanical)
Also dropped the (now-broken) imports for symbols that were deleted upstream when non-BQ warehouses were removed:
Why the file still won't compile yet
The body still references `SSHTunnelProxy` and `parseRedshiftEvalError` (used in the SSH block and the `evaluate()` method respectively). Plus the adapter is missing `executeRaw` and `deleteTable` and uses `sqlanvil.IJDBC` which doesn't exist in current protos. That's Phase 3 scope — interface alignment + proto additions + SSH removal + error formatter swap.
Until Phase 3 lands, the file is excluded from the BUILD globs in both `cli/api/BUILD` and `cli/api/utils/BUILD`:
```bazel
cli/api/BUILD
exclude = [
"utils//.",
"/*_test.ts",
"dbadapters/postgres.ts", # ← Phase 2
],
cli/api/utils/BUILD
exclude = ["postgres.ts"], # ← Phase 2
```
Verification
```bash
./scripts/docker-bazel build //... # → 139 targets, success
```
Stack
Stacked on PR #4 (`adapter/postgres-deps`). Merge order: #1 → #2 → #3 → #4 → this.
Next
Phase 3a — implement `PostgresDbAdapter` against the current `IDbAdapter` contract. Removes the BUILD excludes added here.
Test plan
🤖 Generated with Claude Code