Skip to content

feat(deps): add pg, pg-query-stream, uuid for Postgres adapter (Phase 1) - #4

Closed
ihistand wants to merge 1 commit into
fix/rules-docker-declfrom
adapter/postgres-deps
Closed

feat(deps): add pg, pg-query-stream, uuid for Postgres adapter (Phase 1)#4
ihistand wants to merge 1 commit into
fix/rules-docker-declfrom
adapter/postgres-deps

Conversation

@ihistand

Copy link
Copy Markdown
Collaborator

Summary

Phase 1 of `adapter/postgres-first-class` per `docs/postgres_first_class_design.md` §6.

Adds the npm packages the restored Postgres adapter and `tools/postgres/postgres_fixture.ts` need:

Package Version Purpose
`pg` `^8.11.3` node-postgres client
`pg-query-stream` `^4.5.3` streaming query results
`uuid` `^9.0.0` used by postgres fixture
`@types/pg` `^8.11.0` types for pg
`@types/uuid` `^9.0.0` types for uuid

Also removed `@types/pg-query-stream` from `tools/postgres/BUILD` — that package is a stub (pg-query-stream 4.x bundles its own types) and yarn warns when it's installed. Dropped from `package.json` too.

`yarn.lock` regenerated against the Node 20.20.2 LTS pin from PR #2.

Verification (in Docker)

./scripts/docker-bazel build //tools/postgres/...     # → success
./scripts/docker-bazel build //...                    # → success (139 targets)
./scripts/docker-bazel test  //...                    # → 38/41 pass

This is the first time `bazel build //...` and `bazel test //...` complete on the stack since the rename — every prior PR was blocked at proto-layer or full-tree.

Remaining 3 failures (NOT caused by this PR)

Test Cause
`//cli:index_run_e2e_test` Missing BigQuery test creds (`test_credentials/bigquery.json`)
`//tests/integration:bigquery.spec` Same — needs BigQuery creds
`//tests/api:projects.spec` Pre-existing schema mismatch — test expects `'Compilation timed out'` but `workflow_settings` validation rejects the `warehouse` property as unknown

The first two are environmental. The third is a separate pre-existing test bug to fix in a follow-up.

Stack

Stacked on PR #3 (`fix/rules-docker-decl`). Merge order: #1#2#3 → this.

Next phases

  • Phase 2 (separate PR): relocate `api/dbadapters/postgres.ts` → `cli/api/dbadapters/postgres.ts` and fix imports
  • Phase 3a-c (separate PRs): adapter skeleton, SQL generator, proto schema additions
  • Phase 4 (separate PR): CLI wiring

Test plan

  • `./scripts/docker-bazel build //tools/postgres/...`
  • `./scripts/docker-bazel build //...`
  • `./scripts/docker-bazel test //...` (38/41 — 3 unrelated)

🤖 Generated with Claude Code

Phase 1 of `adapter/postgres-first-class` per docs/postgres_first_class_design.md §6.
Adds the npm packages the restored Postgres adapter needs:

- pg ^8.11.3                   — node-postgres client
- pg-query-stream ^4.5.3       — streaming query results
- uuid ^9.0.0                  — used by tools/postgres fixture
- @types/pg ^8.11.0            — types for pg
- @types/uuid ^9.0.0           — types for uuid

Also removed @types/pg-query-stream from tools/postgres/BUILD; that
package is a stub (pg-query-stream 4.x bundles its own types) and yarn
warns when it's installed. Dropped from package.json too.

yarn.lock regenerated against the new Node 20.20.2 LTS pin (PR #2).

Verified in Docker:
  ./scripts/docker-bazel build //tools/postgres/...     → success
  ./scripts/docker-bazel build //...                    → success (139 targets)
  ./scripts/docker-bazel test  //...                    → 38/41 pass

Remaining failures (not caused by this PR):
  - //cli:index_run_e2e_test          — needs BigQuery test creds
  - //tests/integration:bigquery.spec — needs BigQuery test creds
  - //tests/api:projects.spec         — pre-existing schema mismatch on
    `warehouse` property in workflow_settings validation

Next phase (separate PR): relocate `api/dbadapters/postgres.ts` →
`cli/api/dbadapters/postgres.ts` and fix imports.
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>
@ihistand

ihistand commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded: the Postgres reintegration + Dataform→SQLAnvil rename landed on main directly, and the docs moved to the SQLAnvil/docs repo. Closing as part of #12 (stale-branch prune). The one un-migrated draft, gcp_test_project_setup.md, was migrated to SQLAnvil/docs.

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