forked from bellwether/minerva
33 lines
797 B
Python
33 lines
797 B
Python
import minerva
|
|
import pprint
|
|
|
|
pp = pprint.PrettyPrinter(indent=4)
|
|
|
|
# Create the Minerva object which gives you access to the account under the
|
|
# profile `hay`
|
|
m = minerva.Minerva("hay")
|
|
|
|
# Get the Athena object
|
|
athena = m.athena("s3://haystac-pmo-athena/")
|
|
|
|
# Everything *needs* to have a column in order for unloading to parquet to work,
|
|
# so scalar values have to be assigned something, so here we use `as count` to
|
|
# create a temporary column called `count`
|
|
query = athena.query(
|
|
"""
|
|
select round(longitude, 3) as lon, count(*) as count
|
|
from trajectories.basline
|
|
where agent = 4
|
|
group by round(longitude, 3)
|
|
order by count(*) desc
|
|
"""
|
|
)
|
|
data = query.results()
|
|
|
|
pp.pprint(data.head(10))
|
|
|
|
# We also get important statistics
|
|
print(query.runtime)
|
|
print(query.cost)
|
|
|
|
|