I don't have much experience with python and I am looking for a clean way to send a json(which is the result of a query )to the front end and have structred nice.
The query looks like this:
def myquery(time1, time 2):
query_basictable = """
Select ...
my_data = pd.read_sql(sql=query_basictable, con=engine)
return my_data.to_json()
Now here is where I belive I am mistaking:
df_my_data=myquery(time1, time 2)
data = df_my_data
The json:
data_out = {}
data_out['datas']={}
data_out['datas']['stores']= data
And in the front end:
<td colspan="2" class="{{ data['datas']['stores']}}">
<h4><b>Stores</b></h1>
<h3>{{ data['datas']['stores'] }}</h3>
</td>
The result looks like this:
{"Store":{"0":"Store_013","1":"Store_03"}}
What am I doing wrong in order to have something nice like:
Store_013
Store_03