Area: Ingestion Issues
Sub-Area: BigQuery Source Configuration & Project Discovery
Applies to: OSS + Cloud
Issue
Your BigQuery recipe sets only project_id_pattern, with no project_ids and no project_labels. On each run, DataHub calls the BigQuery projects.list API to find every project the service account can see. Then it keeps the projects that match project_id_pattern. DataHub doesn't save this list between runs. If the API returns a new project on a given run, and that project matches your pattern, DataHub tries to ingest it.
If the BigQuery API is disabled in that project, DataHub records a failure for it. DataHub still ingests your other projects. But any failure in the report marks the whole run as failed.
Error Messages
The ingestion report shows one or both of these failures, with the project ID as context:
Unable to get datasets for projectBigQuery query log fetch failed
For an auto-discovered project, the message under Unable to get datasets for project asks about bigquery.datasets.get and INFORMATION_SCHEMA permissions. It says that even when the real cause is the disabled BigQuery API. Read the exception text below the message to see the Google error. When the project is listed in project_ids and Google's error says the project has not enabled BigQuery, the message says "The project has not enabled BigQuery API" instead.
You Might Be Asking
- Why does the set of projects DataHub ingests change from one run to the next?
- Why did a project with the BigQuery API disabled suddenly fail my run?
- Can DataHub skip projects where the BigQuery API is not enabled instead of failing the run?
- How do I make BigQuery project discovery stable?
Cause
DataHub picks projects in this order:
-
project_ids: DataHub ingests exactly these projects. It doesn't call any project listing API, and it ignoresproject_id_pattern. -
project_labels: DataHub calls the Google Resource Manager project search for projects with any of the labels. Then it appliesproject_id_pattern. - Neither set: DataHub calls BigQuery
projects.listand appliesproject_id_patternto the result.
In option 3, the result is whatever the API returns to the service account on that run. DataHub doesn't check whether the BigQuery API is enabled in a project before it processes it. There is no setting that turns a "BigQuery API not enabled" error into a warning. Both the dataset listing step and the query log step report it as a failure.
Solution
Pick one of these fixes. They go from quickest to most stable. The config keys are described on the BigQuery source page.
- Deny the project that fails.
Add a deny rule for the project ID. DataHub then skips it even when projects.list returns it.
source:
type: bigquery
config:
project_id_pattern:
allow:
- ".*" # keep your existing allow rules
deny:
- "^<disabled-project-id>$" # replace with the real project ID
This only blocks the projects you list. Another project with the BigQuery API disabled can still show up later and fail the run.
- Narrow the allow pattern.
If your allow pattern is broad, match only the project naming convention you want to ingest. Fewer unknown projects can then match.
source:
type: bigquery
config:
project_id_pattern:
allow:
- "^myorg-data-.*-p$" # use your own naming prefix
- Use
project_labels.
Label the GCP projects you want to ingest, then set project_labels. Each entry is one string in key:value format. Keys and values must use lowercase letters, digits, underscores or hyphens, and the key must start with a letter.
source:
type: bigquery
config:
project_labels:
- "datahub-ingest:true"
DataHub uses the Resource Manager project search for this, so the service account needs resourcemanager.projects.list. DataHub still applies project_id_pattern to the labeled projects. Only label projects that have the BigQuery API enabled. A labeled project with the API disabled fails the same way. If no labeled project passes project_id_pattern, the report shows the warning No projects matched provided labels after applying project_id_pattern.
- Use an explicit
project_idslist (most stable).
List the exact projects to ingest. DataHub doesn't call any project listing API, so the set of projects never changes between runs. project_ids overrides project_id_pattern.
source:
type: bigquery
config:
project_ids:
- "<your-project-id-1>"
- "<your-project-id-2>"
You must update this list when you add or remove GCP projects.
To see what projects.list returns, run this as the same service account your recipe uses, and compare the output across days:
bq ls --projects --max_results=1000
If the list changes when nothing changed in your recipe, the change comes from the projects the service account can see in GCP. Check IAM bindings on projects, folders and the organization for that service account.
Additional Notes
- If the
projects.listcall keeps failing, DataHub retries for up to 15 minutes. After that it logsError getting projects, drops any pages it already fetched, and reports the failureGet projects didn't return any project.The run then ingests zero projects, not a partial list. - For production pipelines,
project_idsorproject_labelsgives a stable project set.