-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (27 loc) · 935 Bytes
/
main.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
import itertools
import dbQueries as dbq
import accessDB
def plays(playData=None, startDate=None, endDate=None):
# db = accessDB.accessDatabase()
try:
queryVect = ["ARTIST_ANDOR_TIME", "-artist", str(playData)]
if startDate != None:
queryVect.append("-start")
startDate = dbq.validateDatetimeFormat(startDate)
queryVect.append(startDate)
if endDate != None:
queryVect.append("-end")
endDate = dbq.validateDatetimeFormat(endDate)
queryVect.append(endDate)
output = dbq.runQuery(queryVect)
data = []
header = output['header']
for row in output['rows']:
curTup = {}
for i in xrange(0,len(header)):
curTup[ str(header[i]) ] = str(row[i])
data.append(curTup)
except Exception, e:
print e
lol = 0
plays("rufussounds", "2015-11-25")