Fixes 5963: migrate BigQuery CLI E2E coverage to the v2 framework - #33947
Conversation
Adds the `bigquery` connector suite (22 contracts) under ingestion/tests/cli_e2e_v2, covering every behaviour asserted by v1 test_cli_bigquery.py and test_cli_bigquery_multiple_project.py plus procedures, FKs, repeat ingestion and native samples. Each test owns a labelled, auto-expiring dataset in two GCP projects and scopes every workflow to it. Service-account auth is the CI default; E2E_BQ_AUTH=adc runs locally with Application Default Credentials. Offline meta-tests cover invocation scoping, credentials-by-reference and the pure checks. The v1 tests stay until the stability window completes. Refs open-metadata/openmetadata-collate#5963
|
|
||
|
|
||
| def procedures_have_bodies(snapshot): | ||
| procedure = next((item for item in snapshot.procedures if item.name.root == "sp_active_customer_count"), None) |
There was a problem hiding this comment.
💡 Quality: Use model_str() instead of .root for Pydantic RootModel strings
procedures_have_bodies reads item.name.root and native_sample_rows reads name.root. That goes against the ingestion guideline to convert RootModel values with model_str() from metadata.ingestion.ometa.utils. The file already imports model_str, so switching both call sites costs nothing.
Use model_str for the RootModel conversions:
procedure = next((item for item in snapshot.procedures if model_str(item.name) == "sp_active_customer_count"), None)
...
names = [model_str(name) for name in table.sampleData.columns]
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 closed / 1 findings🟡 Medium risk · Adds live BigQuery E2E fixtures that create, mutate, and delete isolated datasets. Migrates BigQuery CLI E2E coverage to the v2 framework with comprehensive fixture safety (dataset isolation, cleanup on success and failure) and 22 test contracts covering catalog ingestion, filters, deletion, profiling, sampling, and lineage. Consider using 💡 Quality: Use model_str() instead of .root for Pydantic RootModel strings📄 ingestion/tests/cli_e2e_v2/bigquery/checks.py:41 📄 ingestion/tests/cli_e2e_v2/bigquery/checks.py:155
Use model_str for the RootModel conversions🤖 Prompt for agentsOptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
490f461
into
fix/bigquery-types-fk-constraints-profiler
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
…pen-metadata#33946) * fix(ingestion): BigQuery types, FKs, complex constraints, system metrics and profiler Found by strict assertions in the BigQuery CLI E2E v2 migration (open-metadata/openmetadata-collate#5963): - bigquery: reflect NUMERIC/BIGNUMERIC as NUMERIC (was INT) and JSON as JSON (was VARCHAR); profile JSON with a pass-through type because the BigQuery dialect has no JSON deserializer. - bigquery system metrics: restore the per-table filter; every DML job in a dataset was attributed to every profiled table. - common db source: FK lookup falls back to the current database when a connector reports no referred_database (was `svc.None.schema.table`). - column handler: ARRAY/STRUCT/MAP columns get their NULL/NOT_NULL constraint like primitive columns. - bigquery sampler: pass SQLAlchemy 2 `_set_parent` arguments for STRUCT subfields. - profiler: unique count addresses STRUCT subfields by path and runs on the metric thread's session instead of the shared one. * test(cli-e2e-v2): migrate BigQuery CLI E2E coverage to the v2 framework (open-metadata#33947) Adds the `bigquery` connector suite (22 contracts) under ingestion/tests/cli_e2e_v2, covering every behaviour asserted by v1 test_cli_bigquery.py and test_cli_bigquery_multiple_project.py plus procedures, FKs, repeat ingestion and native samples. Each test owns a labelled, auto-expiring dataset in two GCP projects and scopes every workflow to it. Service-account auth is the CI default; E2E_BQ_AUTH=adc runs locally with Application Default Credentials. Offline meta-tests cover invocation scoping, credentials-by-reference and the pure checks. The v1 tests stay until the stability window completes. Refs open-metadata/openmetadata-collate#5963 * fix(ingestion): silence basedpyright errors in FK context lookup and STRUCT unique-count
Describe your changes:
Fixes open-metadata/openmetadata-collate#5963
Stacked on #33946 (base branch
fix/bigquery-types-fk-constraints-profiler); GitHub retargets this tomainonce that merges.I migrated the BigQuery CLI E2E coverage (
cli_e2e/test_cli_bigquery.pyandtest_cli_bigquery_multiple_project.py) to the v2 framework from #27949, because the v2 path asserts persisted OpenMetadata state strictly instead of v1's status-count floors. The strict assertions found the six connector/profiler bugs fixed in #33946. The v1 tests and theirpy-cli-e2e-tests.ymlmatrix entries stay until the agreed stability window completes.Type of change:
High-level design:
Follows
cli_e2e_v2/CONNECTORS.mdwith no shared-core changes. The new code is underingestion/tests/cli_e2e_v2/bigquery/:source.py,conftest.py): BigQuery can't run in a container, so each test creates its own datasete2e_bq_<uuid>(labelowner=cli-e2e-v2, 24h table expiration as a safety net) in two real projects, and deletes it with its contents on success and failure. Every invocation carries an anchoredschemaFilterPatternfor the owned datasets; a schema filter without explicit includes is rejected, so no run can ingest unowned project data.E2E_BQ_*env vars by reference (CI default).E2E_BQ_AUTH=adcruns locally with Application Default Credentials (gcp_adc).connector.py): single-project runs setbillingProjectIdto the second project, as v1 did; multi-project runs use aprojectIdlist.baseline.py,expected.py): authored independently of the connector's parsers, with an explicit BigQuery type map. Types are strict by review decision (NUMERIC →NUMERIC, JSON →JSON).tableDiff.Not included (needs maintainer authorization):
.github/workflows/py-cli-e2e-tests-v2.ymlmust allowlistbigqueryand pass the existingTEST_BQ_*secrets to the BigQuery job only;meta/test_ci_workflow.pyneeds the matching accepted case. Also note the job's 60-minute timeout: the suite takes about 9 minutes with-n 6and longer serially.Tests:
Use cases covered
INFORMATION_SCHEMA.Unit tests
ingestion/tests/cli_e2e_v2/meta/test_bigquery_cases.py(18 offline tests: owned-dataset scoping, credentials by reference, ADC config, invalid invocations, DQ config shape, strict type map, system-profile and partition checks).--e2e-contract-check --collect-onlycollects all 22 contracts exactly once.Backend integration tests
Ingestion integration tests
ingestion/tests/cli_e2e_v2/bigquery/(live suite).Playwright (UI) tests
Manual testing performed
E2E_BQ_AUTH=adc E2E_BQ_PROJECT_ID=open-metadata-beta E2E_BQ_PROJECT_ID2=modified-leaf-330420 python -m pytest ingestion/tests/cli_e2e_v2/bigquery --e2e-contract-check -n 6on top of Fixes 5963: migrate BigQuery CLI E2E to v2 and fix the bugs it found #33946: 25/26 passed in 9m16s. The remaining failure (catalog.multi-project) is a local IAM gap: my user lacks project-levelbigquery.tables.liston the second project, so the region-scoped lifecycle query gets a 403. The CI service account should not hit this.e2e_bq_*datasets ore2e_*services after the runs.UI screen recording / screenshots:
Not applicable.
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>My PR is linked to a GitHub issue via
Fixes #<issue-number>above. — cross-repo link to the Collate tracking issue.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: I updated the migration scripts or explained why it is not needed. — no schema changes.
For UI changes: I attached a screen recording and/or screenshots above. — no UI changes.
I have added tests (unit / integration / Playwright as applicable) and listed them above.
I have added tests around the new logic.
For connector/ingestion changes: I updated the documentation. —
ingestion/tests/cli_e2e_v2/README.md.