-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_buetow_weather.py
executable file
·68 lines (55 loc) · 1.84 KB
/
check_buetow_weather.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/python
import os
import sys
import math
import login
the_db = login.get_db()
import data_objects as DO
###
def do_something():
return None
"""
mysql> select location_id, count(datum) from temps where (invalid is null or invalid !=1) group by location_id;
+-------------+--------------+
| location_id | count(datum) |
+-------------+--------------+
| 1 | 149 |
| 2 | 135 |
| 3 | 176 |
| 5 | 166 |
| 6 | 184 |
| 7 | 183 |
| 8 | 138 |
| 9 | 170 |
| 10 | 155 |
| 11 | 136 |
+-------------+--------------+
10 rows in set (0.00 sec)
mysql> select location_id, count(distinct datum) from temps where (invalid is null or invalid !=1) group by location_id;
+-------------+-----------------------+
| location_id | count(distinct datum) |
+-------------+-----------------------+
| 1 | 148 |
| 2 | 135 |
| 3 | 176 |
| 5 | 165 |
| 6 | 153 |
| 7 | 183 |
| 8 | 138 |
| 9 | 168 |
| 10 | 155 |
| 11 | 136 |
+-------------+-----------------------+
10 rows in set (0.03 sec)
"""
###
def main(argv):
query = """SELECT * from temps WHERE location_id=3 AND invalid != 1O RDER BY datum""".strip()
the_db.query(query)
data = the_db.store_result().fetch_row(how=1, maxrows=0)
print ','.join(map(str, data[0].keys()))
for d in data:
# dobj = DO.DataObject(d.keys(), d.values())
print ','.join(map(str, d.values()))
return None
if __name__ == '__main__': main(sys.argv[1:])