Commit 81b84cf7 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

latest_insertion_date: use the sql query builder

parent 5b60aeaba93c
......@@ -309,12 +309,16 @@ class timeseries(SeriesServices):
def latest_insertion_date(self, cn, seriename):
tablename = self._serie_to_tablename(cn, seriename)
sql = ('select max(insertion_date) '
f'from "{self.namespace}".changeset as cset, '
f' "{self.namespace}.timeserie"."{tablename}" as tstable '
'where cset.id = tstable.cset')
q = sqlq(
'max(insertion_date)'
).relation(
f'"{self.namespace}".changeset as cset',
f'"{self.namespace}.timeserie"."{tablename}" as tstable'
).where(
'cset.id = tstable.cset'
)
return pd.Timestamp(
cn.execute(sql).scalar()
q.do(cn).scalar()
).astimezone('UTC')
def insertion_dates(self, cn, seriename,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment