mirror of https://github.com/apache/superset.git
Ordering columns in the Druid pandas df
This commit is contained in:
parent
6c92fa471d
commit
4aa70d0f43
1
TODO.md
1
TODO.md
|
@ -4,7 +4,6 @@ List of TODO items for Panoramix
|
||||||
## Features
|
## Features
|
||||||
* **URL shortner**
|
* **URL shortner**
|
||||||
* **Dashboard URL filters:** `{dash_url}#fltin__fieldname__value1,value2`
|
* **Dashboard URL filters:** `{dash_url}#fltin__fieldname__value1,value2`
|
||||||
* **Browser history in explore.html:** use location.hash to manage query history
|
|
||||||
* **Default slice:** choose a default slice for the dataset instead of default endpoint
|
* **Default slice:** choose a default slice for the dataset instead of default endpoint
|
||||||
* **refresh freq**: specifying the refresh frequency of a dashboard and specific slices within it, some randomization would be nice
|
* **refresh freq**: specifying the refresh frequency of a dashboard and specific slices within it, some randomization would be nice
|
||||||
* **Color hash in JS:** it'd be nice to use the same hash function for color attribution of series
|
* **Color hash in JS:** it'd be nice to use the same hash function for color attribution of series
|
||||||
|
|
|
@ -916,6 +916,15 @@ class Datasource(Model, AuditMixinNullable, Queryable):
|
||||||
client.groupby(**qry)
|
client.groupby(**qry)
|
||||||
query_str += json.dumps(client.query_dict, indent=2)
|
query_str += json.dumps(client.query_dict, indent=2)
|
||||||
df = client.export_pandas()
|
df = client.export_pandas()
|
||||||
|
|
||||||
|
# Reordering columns
|
||||||
|
cols = []
|
||||||
|
if 'timestamp' in df.columns:
|
||||||
|
cols += ['timestamp']
|
||||||
|
cols += [col for col in groupby if col in df.columns]
|
||||||
|
cols += [col for col in metrics if col in df.columns]
|
||||||
|
cols += [col for col in df.columns if col in cols]
|
||||||
|
df = df[cols]
|
||||||
return QueryResult(
|
return QueryResult(
|
||||||
df=df,
|
df=df,
|
||||||
query=query_str,
|
query=query_str,
|
||||||
|
|
Loading…
Reference in New Issue