Area: Product Issues
Sub-Area: Freshness Assertions
Applies to: Cloud
Issue
A freshness assertion created with Detect with AI on a BigQuery table never finishes training. This happens even when the BigQuery console shows a recent last modified time for the table. Seven days after you create the assertion, it reports this error:
No operations have been reported on this dataset during the past 7 day(s), so no freshness prediction can be made. Please check your ingestion configuration to ensure operations are emitted for this dataset, or contact your administrator for support.
Separately, a freshness assertion that uses the Information Schema change source can fail or error even when the table looks healthy in BigQuery.
You Might Be Asking
- Why doesn't my AI freshness assertion train, even after I recreate it?
- Why does the Information Schema freshness check fail when BigQuery shows a recent change?
- What permissions do freshness assertions on BigQuery need?
Cause
AI freshness assertions don't learn from BigQuery's last modified time. They train on DataHub Operation events (the operation aspect) for the dataset. BigQuery ingestion creates these events from the BigQuery job history. To train, the model needs at least 10 operations, and the first and last of them must be at least 7 days apart. DELETE, DROP and SELECT operations don't count. If ingestion emits no operations for the table, the model can't train, whatever Change Source the assertion uses.
Recreating the assertion doesn't fix this. A new assertion waits 7 days from its creation before it reports the missing operations error, so recreating it only delays the error.
Information Schema checks work differently. They query the dataset's __TABLES__ metadata with the service account from your BigQuery connection. The check fails when that query can't run. It also fails when the table's last modified time falls outside the assertion's check window.
Solution
1. Make sure ingestion emits operations
BigQuery ingestion builds operations from the job history it reads. Check that your recipe keeps these settings on. Both default to true, so you only need to check that nothing turns them off:
source:
type: bigquery
config:
include_usage_statistics: true
usage:
include_operational_stats: true
Also check these points (see the BigQuery source docs):
- The ingestion service account needs
bigquery.jobs.listAll(included inroles/bigquery.resourceViewer). Without it, ingestion can't read jobs that other users or service accounts submitted. - Ingestion reads each ingested project's own job history. If the jobs that write your table run in a different project, such as a separate billing or backfill project, ingest that project too.
- Operations only arrive when ingestion runs, so run the BigQuery source on a regular schedule.
To confirm operations exist, open the dataset in DataHub, go to the Stats tab and look at the Change History chart. If it shows no inserts or updates over the last 7 days, the AI model has nothing to train on.
If ingestion can't see your loads, report operations from the pipeline that loads the table. Use the reportOperation GraphQL mutation or the Python SDK, as shown in Operations.
2. Use a fixed schedule with Platform API while operations build up
If you need a working check now, create a freshness assertion with a fixed schedule instead of Detect with AI. Click Advanced and set the change source to Platform API. Platform API calls the BigQuery tables.get API to read the table's last modified time. It runs no query and needs the bigquery.tables.get permission (included in roles/bigquery.metadataViewer). It works for tables only, not views. See Freshness Assertions.
Switching an AI assertion to Platform API doesn't skip training. AI assertions always train on DataHub operations, so step 1 still applies to them.
3. Fix Information Schema failures
If the assertion shows an error that starts with Source query (BigQuery) failed with error:, BigQuery rejected the query. The text after it is the BigQuery error, so start from that message. The Information Schema change source needs roles/bigquery.metadataViewer and roles/bigquery.dataViewer for the service account in your BigQuery connection.
4. Match the schedule to the table's real update cadence
The assertion passes only if the table changed inside the check window. If a table updates every 3 days but the assertion expects a change every day, the assertion fails, and that failure is correct. Set the schedule and window to how often the table really changes.