0

I'm trying to convert a simple Impala sql query to an ibis query in python, but I'm having trouble understanding ibis's syntax when converting from sql.

So far, I've tried this:

agg = joblist_table_handle.lastupdatedate.max()
joblist = joblist_table_handle.group_by('id').aggregate(agg).sort_by('lastupdatedate').execute()

I'm hoping to get my result close to the sql query:

SELECT id, max(lastupdatedate) 
FROM joblist_table
GROUP BY id
SORT BY lastupdatedate

Any help is appreciated.

Phillip Cloud
  • 24,919
  • 11
  • 68
  • 88
Trincity
  • 149
  • 9

1 Answers1

1

You need to name your aggregation (note the last_update_date=agg keyword argument passed to the aggregate call):

agg = joblist_table_handle.lastupdatedate.max()
joblist = joblist_table_handle.group_by('id').aggregate(last_update_date=agg).sort_by('last_update_date').execute()
Phillip Cloud
  • 24,919
  • 11
  • 68
  • 88