Skip to content

Instantly share code, notes, and snippets.

@DazWilkin
Created June 11, 2021 16:07
Show Gist options
  • Save DazWilkin/cb3dc429d2ba410ac500a9b28f3af5ff to your computer and use it in GitHub Desktop.
Save DazWilkin/cb3dc429d2ba410ac500a9b28f3af5ff to your computer and use it in GitHub Desktop.
Stackoverflow #67888711
fields = ["campaign.id", "segments.device"]
query = """
SELECT {fields}
FROM campaign
WHERE segments.date = '{date}'
LIMIT 10
""".format(
fields=",".join([str(f) for f in fields]),
date="210611",
)
response = ga_service.search_stream(
customer_id=customer_id,
query=query,
)
for batch in response:
for row in batch.results:
for field in fields_list:
print("{field}: {value}".format(
field=field,
value=row[field],
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment