forked from bellwether/minerva
better support for params within athena
This commit is contained in:
parent
ea31c8e8c0
commit
0e5542cecf
3 changed files with 32 additions and 10 deletions
22
test.py
22
test.py
|
|
@ -5,6 +5,7 @@ pp = pprint.PrettyPrinter(indent=4)
|
|||
|
||||
m = minerva.Minerva("hay")
|
||||
athena = m.athena("s3://haystac-pmo-athena/")
|
||||
|
||||
#query = athena.query(
|
||||
#"""SELECT *
|
||||
#FROM trajectories.kitware
|
||||
|
|
@ -13,13 +14,26 @@ athena = m.athena("s3://haystac-pmo-athena/")
|
|||
# ST_Point(longitude, latitude)
|
||||
#)
|
||||
#""")
|
||||
query = athena.query("select count(*) as count from trajectories.kitware where agent = ?", [4])
|
||||
data = query.results()
|
||||
pp.pprint(data.head(10))
|
||||
print(query.runtime)
|
||||
|
||||
# Everything *needs* to have a column in order for parquet to work, so scalar
|
||||
# values have to be assigned something, so here we use `as count` to create
|
||||
# a temporary column called `count`
|
||||
#print(athena.query("select count(*) as count from trajectories.kitware").results().head(1))
|
||||
|
||||
query = athena.query(
|
||||
"""
|
||||
select round(longitude, 3) as lon, count(*) as count
|
||||
from trajectories.kitware
|
||||
where agent = 4
|
||||
group by round(longitude, 3)
|
||||
order by count(*) desc
|
||||
"""
|
||||
)
|
||||
data = query.results()
|
||||
pp.pprint(data.head(10))
|
||||
print(query.runtime)
|
||||
|
||||
#import IPython
|
||||
#IPython.embed()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue