I have an sqlite query which returns the following python list of tuples:
[(u'1623,0.0,1651,2.0e-06,1679,5.0e-06,1707,7.0e-06,1735,9.0e-06,1762,1.1e-05,1790,1.4e-05'),
( u'1933,458273.7,1940,460182.6,1947,464019.3,1954,465922.8,1961,467856.0,1968,479385.0')]
Each string here contains a tuple of x,y pairs i.e.one item is 1623,0.0 The output which I want is:
[(1623,0.0,1651,2.0e-06,1679,5.0e-06,1707,7.0e-06,1735,9.0e-06,1762,1.1e-05,1790,1.4e-05),
(1933,458273.7,1940,460182.6,1947,464019.3,1954,465922.8,1961,467856.0,1968,479385.0)]
Is there an efficient way to perform this translation?
Maybe it can be performed at the sql level but I dont think so, my query is as follows:
select group_concat( COALESCE(timestamp, "")
|| COALESCE(",", "")
|| COALESCE(value, "") )
from table where type='VALUE' group by eventid;
I cant find a way to concatenate more than one column without converting it to a string
timestamp, value?COALESCE(",", "")is always going to be",", so why are you usingCOALESCEthere at all?