-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist_tables.py
More file actions
executable file
·36 lines (29 loc) · 907 Bytes
/
list_tables.py
File metadata and controls
executable file
·36 lines (29 loc) · 907 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This function prints to screen the list of BigQuery Tables and downloads the view's queries.
It may be ran without input parameters (in which case it uses hard-coded defaults) or
with a json file as 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,
"table_list_file": "table_list.txt",
"get_views": True,
"views_path": "../views/",
"scheduled_path": "../scheduled_queries/"
}
# Run code:
d.list_tables(config)