Skip to content

Commit a63b607

Browse files
authored
Merge pull request #17 from googleads/gaql_validation
Gaql validation
2 parents 1cc743a + 762d5d8 commit a63b607

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* 1.5.0
2+
- Added rigorous GAQL validation rules to GEMINI.md
3+
14
* 1.4.2
25
- Updated tests for setup.sh and update.sh
36

GEMINI.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ This document outlines mandatory operational guidelines, constraints, and best p
8282
- **Date Ranges:** Compute dates dynamically (no constants like `LAST_90_DAYS`).
8383
- **Conversion Summaries:** Use `daily_summaries` for date-segmented data from `offline_conversion_upload_conversion_action_summary` and `offline_conversion_upload_client_summary`.
8484

85+
#### 3.3.1. Rigorous GAQL Validation
86+
87+
When validating a GAQL query, you MUST follow this process:
88+
89+
1. Initial Field Validation: For each field in the query, use GoogleAdsFieldService to verify that it is selectable and filterable.
90+
91+
2. Contextual Compatibility Check: Do not assume that a filterable field is filterable in all contexts. You MUST verify its compatibility with the resource in the FROM clause. To do this, you MUST:
92+
* Query the GoogleAdsFieldService for the main resource in the FROM clause.
93+
* Examine the selectable_with attribute of the main resource to find the correct fields for filtering.
94+
95+
3. Segment Rule: You MUST verify that any segment field used in the WHERE clause is also present in the SELECT clause, unless it is a core date segment (segments.date, segments.week, segments.month, segments.quarter, segments.year).
96+
97+
4. Prioritize Validator Errors: If the user provides an error message from a GAQL query validator, you MUST treat that error message as the definitive source of truth. You MUST immediately re-evaluate your validation and correct the query based on the error message.
98+
8599
#### 3.4. Code Generation
86100
- **Language:** Infer the target language from user request, existing files, or project context. Default to Python if ambiguous.
87101
- **Reference Source:** Refer to official Google Ads API client library examples for the target language.

0 commit comments

Comments
 (0)