Skip to content

Commit

Permalink
Influx showstopper, this is as far as I got
Browse files Browse the repository at this point in the history
Alltough Influx allows irregular time series, downsampling does not work
really: if you query a time span it may omit a measurement from
result, if now data point was encountered in this span.
Likewise, if no measurement occured in the earliest grouped by
intervali(s) empty fields will be returned.
There is frustrated discussion in
influxdata/influxdb#6878 and no progress since ~6 years.

Will evaluate QuestDB in a side branch.
  • Loading branch information
schwabix-1311 committed May 30, 2023
1 parent 5813945 commit 03f81e4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions aquaPi/machineroom/misc_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ def query(self, node_names, start=0, step=0):
log.debug(' done, overall %fs', time() - qry_begin)
return result

def query_influx(db_name, flux):
breakpoint()
if not INFLUX_SRV:
pass
elif INFLUX_SRV == 'localhost':
os.system(f'influx -database={db_name} -precision=s -execute "{flux}"')
else:
_curl_query(flux, option="db={db_name}&precision=s")
return []


# ========== miscellaneous ==========

Expand Down Expand Up @@ -362,9 +372,10 @@ def get_history(self, start, step):
return self.db.query(self._inputs.sender, start, step)

def get_history(self, start, step):
h = influx_query('aquaPi',
'select time, %s from %s where time > %d'
% (','.join(self._inputs.sender), self.id, start))
h = query_influx('aquaPi',
f'SELECT time, * FROM {self.id} WHERE time > {start}'
#'SELECT time, mean(*) FROM {self.id} WHERE time > {start}'
#% (','.join(self._inputs.sender), self.id, start))
hist = []
return hist

Expand Down

0 comments on commit 03f81e4

Please sign in to comment.