bach for Google Ads
bach provides an easy to use set of abstractions to simplify
developing Google Ads solutions related to Google Ads management.
Most of the solutions consist of three phases:
- Extract some data
- Do some transformation
- Do something with transformed data
bach solves first two generically by simplifying fetching data and applying filtering rules to the fetched data;
the third step is defined as an interface developers can use to build on top of it.
Responsible for orchestrating rules and applying complex rules in Google Ads. Consists of 3 elements:
- Rule to Query - takes complex rules and build GAQL query out of it; query is executed and returned as a
Report. - Rule to Report - applies Rule to Report to get a subset of actionable entities.
- Report to Action - does whatever needs to be done with the subset of data (notification, exclusion, increase / decrease).
Installation
pip install bach-googleads
Usage
- Simple use case - use predefined queries.
from bach import (
Bach,
actions,
notifications_channel,
plugins,
)
from bach.adapters import repositories
task_repo = repositories.SqlAlchemyRepository(
db_url='sqlite:///tasks.db', model=tasks.Task
)
bach = Bach(task_repo)
(
bach
.with_type('placement_performance')
.with_accounts(ACCOUNT_ID)
.with_actor(
plugins.PlacementExclusionActor,
exclusion_level='CAMPAIGN',
)
.add_rules('clicks > 10')
.add_action(actions.Action.EXCLUDE)
.add_notify(notifications_channel.Console())
)
bach.run()
bach_task = bach.as_task(name='task_name')
- Simple use case - use custom query.
from bach import Bach
query = 'SELECT campaign.id, metrics.clicks AS clicks FROM campaign'
(
bach
.with_accounts(ACCOUNT_ID)
.add_rules('clicks > 0')
.fetch(query)
.apply()
.notify()
)
- Advanced use case - use custom fetcher.
from bach import Bach
from bach.fetchers import placement_fetcher
(
bach
.with_fetcher(placement_fetcher.PlacementFetcher())
.with_accounts(ACCOUNT_ID)
.add_rules('clicks > 0')
.fetch()
.apply()
.notify()
)
- Running a task.
from bach import Bach, tasks
task = tasks.Task(
name='test_task',
type='campaign_performance',
customer_ids=ACCOUNT_ID,
rule_expression='clicks > 1',
extra_info={'campaign_type': 'DISPLAY'},
)
bach.run_task(task)
Metadata
Release files for bach-googleads 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bach_googleads-0.0.0.tar.gz | 21.8 kB | Without provenance | Details for bach_googleads-0.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bach_googleads-0.0.0-py3-none-any.whl | Python 3 | none | any | Details for bach_googleads-0.0.0-py3-none-any.whl |
Total release size: 55.8 kB
Release files / bach_googleads-0.0.0.tar.gz
| Download URL | bach_googleads-0.0.0.tar.gz |
|---|---|
| Size | 21.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d30bfe2afe41bf7711f59566fe21e3f789656e7fa012de6fcd168ba6ee1444f9
|
|
BLAKE2b-256 checksum How to use checksums |
b05a8e97a88f0eee988e287dbb2d69dad57a9ccd7abd485e4df8b9a61e333255
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.4
|
Release files / bach_googleads-0.0.0-py3-none-any.whl
| Download URL | bach_googleads-0.0.0-py3-none-any.whl |
|---|---|
| Size | 34.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c6583558c09252b4423b6d439baec88211c40911d594abb8946201768a984aea
|
|
BLAKE2b-256 checksum How to use checksums |
0b82c037e22e322ae0525ddaec0aad976095130a67770db530378b3ab1538217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.4
|
Security for bach-googleads 0.0.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.