Skip to main content

GAQL CLI

PyPI version PyPI downloads

A CLI for running GoogleAds queries.

Usage

Installing

  • pip install gaql
  • pipx install gaql (recommended)

Querying

The default mode. Runs either as a REPL, or as a one off command

- gaql [ACCOUNT_ID] - run in REPL mode
- gaql [ACCOUNT_ID] [WORDS*] - run a single query. Note depending on your shell you may need to quote some queries if you run like this.

flags:
--help show the help message; basically the below
-f|--format <csv|json|jsonl|proto> specify an output format
-o|--output <file> specify an output file. Based on the extension, format is inferred. Non REPL usage only

Examples, using 1-000-000-000 as our demo account id:

# opens a REPL with json lines as the output format
gaql -f jsonl 1-000-000-000

# runs the query against the given account, outputting to the terminal the results as json lines
gaql -f jsonl 1-000-000-000 'SELECT campaign.id FROM campaign'

# runs the query against the given account, outputting to 'campaigns.jsonl' the result as json lines
gaql -o campaigns.jsonl 1-000-000-000 'SELECT campaign.id FROM campaign'

tip: by default LIMIT 100 will be added to your queries. To override this behavior, simply define your own LIMIT X.

tip: the autocomplete will return only valid fields for the selected entity if you fill out the FROM <entity> part first.

Other tools

Used for useful common queries. Currently only supports getting all accounts under an MCC, to help when managing multiple accounts. The MCC is taken from the login_customer_id field.

  • gaql-tools queries clients

Notes

  • credentials come from the environment > the google .yaml file > a user provided credential file
  • credentials, settings, and history are stored in ./config/gaql/*. The credential file will only be present if you create it through a prompt (i.e you aren't using the ENV, or the YAML file Google specifies)

Ideas / TODO

  • tables as an output format
  • autocomplete for account ids (with caching)

Development

We're using poetry for local development, package management, and publishing. pyenv is recommended for Python version management, and pipx for installation.

Build commands:

make develop - install a development version. run via `poetry run gaql <args>`
make publish - build and distribute to PyPi
make clean   - remove the existing build files
make format  - run black over the code
make lint    - lint and format the code

Security

For sensitive security matters please contact security@getyourguide.com.

gaql-cli is licensed under the Apache License, Version 2.0. See LICENSE for the full text.

Metadata

Release files for gaql 1.19.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gaql 1.19.0
File Size Uploaded Provenance Actions
gaql-1.19.0.tar.gz 140.8 kB Without provenance Details for gaql-1.19.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gaql 1.19.0
File Interpreter ABI Platform Actions
gaql-1.19.0-py3-none-any.whl Python 3 none any Details for gaql-1.19.0-py3-none-any.whl

Total release size: 287.6 kB

Release files / gaql-1.19.0.tar.gz

Download URL gaql-1.19.0.tar.gz
Size 140.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a202426b1b946891623a6e6dfb8ce5c85da34f1764feaf4876620f5aef175b2c
BLAKE2b-256 checksum
How to use checksums
663dac92d8d192ce694cc1cfffb70ef27b49455f866f41ced3c20a08f08574b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.2 Darwin/27.2.0

Release files / gaql-1.19.0-py3-none-any.whl

Download URL gaql-1.19.0-py3-none-any.whl
Size 146.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e09e9c375aaaab88bb015fa6369bb0409418b3df335ede4cc7a12b6b17e02891
BLAKE2b-256 checksum
How to use checksums
3d712548da958c576be0f82fdd334ceeab80d3ffeecf927dc8756025df6acb5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.2 Darwin/27.2.0

Security for gaql 1.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page