-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_scheduled_queries.py
More file actions
executable file
·39 lines (31 loc) · 986 Bytes
/
get_scheduled_queries.py
File metadata and controls
executable file
·39 lines (31 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Input:
config - a string for a filename of a json file.
Runs the bash command 'gcloud auth print-access-token' to get the access token,
then uses it to enter the BigQuery API via http requests and download all info about
scheduled queries, in particular their query codes. Saves them to directory specified
in the config.
Created by: Henrique S. Xavier, hsxavier@if.usp.br, 12/sep/2019.
"""
import sys
import download_bigquery_info as d
# Docstring output:
if len(sys.argv) > 1 + 1:
print(__doc__)
sys.exit(1)
# Get input config:
elif len(sys.argv) == 1 + 1:
config = sys.argv[1]
# Set default config:
else:
config = {
"credentials": "/home/skems/gabinete/projetos/keys-configs/gabinete-compartilhado.json",
"printout": True,
"get_views": True,
"views_path": "../views/",
"scheduled_path": "../scheduled_queries/"
}
# Run code:
d.get_scheduled_queries(config)