Python Client 'query_data_frame' does not return multiple DataFrames

Hello,

In the documentation and ‘query_api.py’ file, it says

Note that if a query returns more then one table than the client generates a DataFrame for each of them.

So this query returns 2 tables as seen below,

However, when I use query_data_frame(), there is only 1 dataframe, as seen below,

What I was expecting is something like this;

df_list = influx_query_api.query_data_frame(query=query)
for df in df_list:
    print(df)
   # work on each dataframe, etc..

so there should be 2 dataframes, right? as seen below


what am I doing wrong here?

Hi @gorkem,

thanks for using our client.

The documentation does not describe it accurately. A new table is created when the results contains tables with different schemas. Something like:

#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double
#group,false,false,true,true,false,true,false,false
,result,table,_start,_stop,_time,region,host,_value
,mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43
,mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25
,mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62

#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,string,string,double
#group,false,false,true,true,false,true,false,false
,result,table,_start,_stop,_time,location,device,min,max
,mean,1,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,USA,5825,62.73,68.42
,mean,1,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,USA,2175,12.83,56.12
,mean,1,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,USA,6913,51.62,54.25

Regards

1 Like