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.

Legal

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

Metadata

Release files for gaql 1.17.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.17.0
File Size Uploaded
gaql-1.17.0.tar.gz 131.3 kB Details

Built distribution (wheel)

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

Total release size: 269.0 kB

Release files / gaql-1.17.0.tar.gz

Download URL gaql-1.17.0.tar.gz
Size 131.3 kB
Tags Source
SHA-256 checksum
How to use checksums
04d646d5ccc167ab8504105f66e5f4d35d546cfcd52f74ab5516d31edb822c05
BLAKE2b-256 checksum
How to use checksums
00fdd07dd25636a3e50fcbb231abe76a7751f66bb27fd4c691419219a654170e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Darwin/25.5.0

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

Download URL gaql-1.17.0-py3-none-any.whl
Size 137.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
841fe365a1cdbbe223c5feeffad3c3226e03d20d0e66d970e0f96f15d9f87da1
BLAKE2b-256 checksum
How to use checksums
a25dab88ae0ba53efa9308fe6961749939a8c3cc1c548076304320c882abdd3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Darwin/25.5.0

Release history Release notifications | RSS feed

This release

1.17.0 This release

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.12.1

2 release files

1.12.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

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