@@ -593,7 +593,8 @@ def get_attribute_values(self,table,start_date=None,stop_date=None,
593593 query = 'select %s from %s %s order by data_time' \
594594 % (what ,table ,interval )
595595 if desc : query += " desc" # or (not stop_date and N>0):
596- if N > 0 : query += ' limit %s' % N
596+ if N > 0 :
597+ query += ' limit %s' % (N if 'array' not in table else 1024 )
597598
598599 ######################################################################
599600 # QUERY
@@ -605,13 +606,14 @@ def get_attribute_values(self,table,start_date=None,stop_date=None,
605606 ######################################################################
606607
607608 if 'array' in table :
608- t = result [0 ][0 ]
609- interval += " and CAST(UNIX_TIMESTAMP(data_time) as INT) = '%s'" \
610- % round (t )
611- query = 'select %s from %s %s order by data_time' \
612- % (what , table , interval )
613- self .warning (query )
614- result = self .Query (query )
609+ #t = result[0][0]
610+ #if 0: #N == 1:
611+ #interval += " and CAST(UNIX_TIMESTAMP(data_time) as INT) = '%s'" \
612+ #% round(t)
613+ #query = 'select %s from %s %s order by data_time' \
614+ #% (what, table, interval)
615+ #self.warning(query)
616+ #result = self.Query(query)
615617 data = fandango .dicts .defaultdict (list )
616618 for t in result :
617619 data [float (t [0 ])].append (t [1 :])
@@ -625,6 +627,7 @@ def get_attribute_values(self,table,start_date=None,stop_date=None,
625627 break
626628 l [t [0 ]] = t [1 ] #Ignoring extra columns (e.g. quality)
627629 result .append ((k ,l ))
630+ if N > 0 : result = result [- N :]
628631 self .warning ('array arranged [%d] in %f s'
629632 % (len (result ),time .time ()- t0 ))
630633 t0 = time .time ()
0 commit comments