Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why is the slice_id in params not inconsistent with the actual id? #1368

Closed
flametest opened this issue Oct 18, 2016 · 1 comment
Closed

Comments

@flametest
Copy link
Contributor

flametest commented Oct 18, 2016

created_on | 2016-08-26 19:06:30.122167
changed_on | 2016-10-17 19:44:01.940737
id | 156
slice_name | for_test
druid_datasource_id | 12
table_id |
datasource_type | druid
datasource_name | test_datasource
viz_type | table
params | {\r
| "add_to_dash": "false",\r
| "collapsed_fieldsets": "",\r
| "datasource_id": "12",\r
| "datasource_name": "hotel_mdw_order_v3",\r
| "datasource_type": "druid",\r
| "druid_time_origin": "",\r
| "flt_col_0": "advance_booking_days",\r
| "flt_col_1": "city_code",\r
| "flt_col_2": "terminal_channel_type",\r
| "flt_eq_0": "",\r
| "flt_eq_1": "beijing_city,shanghai_city,chengdu,guangzhou,hangzhou,chongqing_city,shenzhen,xian,xiamen,sanya,wuhan,nanjing,changsha,kunming,qingdao,suzhou_jiangsu,lijiang,tianjin_city,zhengzhou,hongkong_city,dali,hefei,jinan,haerbin,haikou,dalian,guilin,nanning,fuzhou_fujian,shenyang,guiyang,zhuhai,shijiazhuang,ningbo,taiyuan,wulumuqi,nanchang,wuxi,jiaxing,dongguan,",\r
| "flt_eq_2": "app",\r
| "flt_op_0": "in",\r
| "flt_op_1": "in",\r
| "flt_op_2": "in",\r
| "goto_dash": "false",\r
| "granularity": "1 hour",\r
| "groupby": [\r
| "order_date",\r
| "country_name",\r
| "province_name",\r
| "city_name"\r
| ],\r
| "having_col_0": "advance_booking_days",\r
| "having_eq_0": "",\r
| "having_op_0": ">",\r
| "include_search": "false",\r
| "metrics": [\r
| "\u95f4\u591c\u5e73\u5747\u623f\u8d39"\r
| ],\r
| "new_dashboard_name": "",\r
| "new_slice_name": "\u5206\u57ce\u5e02\uff08\u91cd\u70b9\uff09APP",\r
| "number_format": "r",\r
| "rdo_save": "saveas",\r
| "row_limit": "50000",\r
| "save_to_dashboard_id": "",\r
| "since": "2016-8-20",\r
| "slice_id": "155",\r
| "slice_name": "\u5206\u57ce\u5e02\uff08\u91cd\u70b9\uff09APP",\r
| "table_timestamp_format": "smart_date",\r
| "until": "2016-8-21",\r
| "userid": "52",\r
| "viz_type": "table"\r
| }
created_by_fk | 52
changed_by_fk | 54
description |
cache_timeout |
perm | [Druid Cluster].test_datasource

In table slices of caravel database, why is the id of slice not the same as the slice_id in params column?

json_endpoint url requested in dashboard is generated using the items in params.

And as a result the json_endpoint url pass the wrong slice_id.

`class Caravel(BaseCaravelView):

"""The base views for Caravel!"""

@has_access
@expose("/explore/<datasource_type>/<datasource_id>/")
@expose("/datasource/<datasource_type>/<datasource_id>/")  # Legacy url
@log_this
def explore(self, datasource_type, datasource_id):

    error_redirect = '/slicemodelview/list/'
    datasource_class = models.SqlaTable \
        if datasource_type == "table" else models.DruidDatasource
    datasources = (
        db.session
        .query(datasource_class)
        .all()
    )
    datasources = sorted(datasources, key=lambda ds: ds.full_name)
    datasource = [ds for ds in datasources if int(datasource_id) == ds.id]
    datasource = datasource[0] if datasource else None
    slice_id = request.args.get("slice_id")`
@flametest flametest changed the title why slice_id in params is not inconsistent with the actual id? why the slice_id in params is not inconsistent with the actual id? Oct 18, 2016
@flametest flametest changed the title why the slice_id in params is not inconsistent with the actual id? why is the slice_id in params not inconsistent with the actual id? Oct 18, 2016
@flametest
Copy link
Contributor Author

fixed in #547

zhaoyongjie added a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
* refactor: improve code smell for postprocessing

* jest UT

* best practice for jest
zhaoyongjie added a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
* refactor: improve code smell for postprocessing

* jest UT

* best practice for jest
zhaoyongjie added a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
* refactor: improve code smell for postprocessing

* jest UT

* best practice for jest
zhaoyongjie added a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
* refactor: improve code smell for postprocessing

* jest UT

* best practice for jest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant