From 79705d27aa10fabfd8b92ca9abfb4bd238d4393e Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Thu, 11 Oct 2018 16:43:48 -0700 Subject: [PATCH 1/6] allow cache and force refresh on table list --- .../SqlLab/components/SqlEditorLeftBar.jsx | 77 +++++++++++-------- superset/db_engine_specs.py | 38 ++++++++- superset/models/core.py | 26 ++++++- superset/views/core.py | 13 ++-- 4 files changed, 111 insertions(+), 43 deletions(-) diff --git a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx index d8db05cb3591a..84f6aada540d0 100644 --- a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx @@ -41,12 +41,10 @@ class SqlEditorLeftBar extends React.PureComponent { onDatabaseChange(db, force) { const val = db ? db.value : null; this.setState({ schemaOptions: [] }); + this.setState({ tableOptions: [] }); this.props.actions.queryEditorSetSchema(this.props.queryEditor, null); this.props.actions.queryEditorSetDb(this.props.queryEditor, val); - if (!(db)) { - this.setState({ tableOptions: [] }); - } else { - this.fetchTables(val, this.props.queryEditor.schema); + if (db) { this.fetchSchemas(val, force || false); } } @@ -69,11 +67,15 @@ class SqlEditorLeftBar extends React.PureComponent { resetState() { this.props.actions.resetState(); } - fetchTables(dbId, schema, substr) { + fetchTables(dbId, schema, force) { // This can be large so it shouldn't be put in the Redux store + // This function has never been called with substr param so we just + // assign null to substr and have it passed to the endpoint. + const substr = null; + const forceRefresh = force || false; if (dbId && schema) { this.setState({ tableLoading: true, tableOptions: [] }); - const url = `/superset/tables/${dbId}/${schema}/${substr}/`; + const url = `/superset/tables/${dbId}/${schema}/${substr}/${forceRefresh}/`; $.get(url).done((data) => { const filterOptions = createFilterOptions({ options: data.options }); this.setState({ @@ -110,10 +112,10 @@ class SqlEditorLeftBar extends React.PureComponent { } this.props.actions.addTable(this.props.queryEditor, tableName, schemaName); } - changeSchema(schemaOpt) { + changeSchema(schemaOpt, force) { const schema = (schemaOpt) ? schemaOpt.value : null; this.props.actions.queryEditorSetSchema(this.props.queryEditor, schema); - this.fetchTables(this.props.queryEditor.dbId, schema); + this.fetchTables(this.props.queryEditor.dbId, schema, force); } fetchSchemas(dbId, force) { const actualDbId = dbId || this.props.queryEditor.dbId; @@ -214,30 +216,41 @@ class SqlEditorLeftBar extends React.PureComponent { ) - {this.props.queryEditor.schema && - - } +
+
+ {this.props.queryEditor.schema && + + } +
+
+ +
+

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 172cf9cc86831..acab2ed925320 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -312,9 +312,27 @@ def get_schema_names(cls, inspector, db_id, return inspector.get_schema_names() @classmethod - def get_table_names(cls, schema, inspector): + @cache_util.memoized_func( + enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), + timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), + key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( + db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) + ) + def get_table_names(cls, inspector, db_id, schema, + enable_cache, cache_timeout, force=False): return sorted(inspector.get_table_names(schema)) + @classmethod + @cache_util.memoized_func( + enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), + timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), + key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:view_list'.format( + db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) + ) + def get_view_names(cls, inspector, db_id, schema, + enable_cache, cache_timeout, force=False): + return sorted(inspector.get_view_names(schema)) + @classmethod def where_latest_partition( cls, table_name, schema, database, qry, columns=None): @@ -438,7 +456,14 @@ class PostgresEngineSpec(PostgresBaseEngineSpec): engine = 'postgresql' @classmethod - def get_table_names(cls, schema, inspector): + @cache_util.memoized_func( + enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), + timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), + key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( + db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) + ) + def get_table_names(cls, inspector, db_id, schema, + enable_cache, cache_timeout, force=False): """Need to consider foreign tables for PostgreSQL""" tables = inspector.get_table_names(schema) tables.extend(inspector.get_foreign_table_names(schema)) @@ -596,7 +621,14 @@ def convert_dttm(cls, target_type, dttm): return "'{}'".format(iso) @classmethod - def get_table_names(cls, schema, inspector): + @cache_util.memoized_func( + enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), + timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), + key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( + db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) + ) + def get_table_names(cls, inspector, db_id, schema, + enable_cache, cache_timeout, force=False): """Need to disregard the schema for Sqlite""" return sorted(inspector.get_table_names()) diff --git a/superset/models/core.py b/superset/models/core.py index 7e1aaf4d4e2b1..2bc0206ef5db2 100644 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -847,8 +847,18 @@ def all_table_names(self, schema=None, force=False): tables_dict = self.db_engine_spec.fetch_result_sets( self, 'table', force=force) return tables_dict.get('', []) - return sorted( - self.db_engine_spec.get_table_names(schema, self.inspector)) + + extra = self.get_extra() + medatada_cache_timeout = extra.get('metadata_cache_timeout', {}) + table_cache_timeout = medatada_cache_timeout.get('table_cache_timeout') + enable_cache = 'table_cache_timeout' in medatada_cache_timeout + return sorted(self.db_engine_spec.get_table_names( + inspector=self.inspector, + db_id=self.id, + schema=schema, + enable_cache=enable_cache, + cache_timeout=table_cache_timeout, + force=force)) def all_view_names(self, schema=None, force=False): if not schema: @@ -859,7 +869,17 @@ def all_view_names(self, schema=None, force=False): return views_dict.get('', []) views = [] try: - views = self.inspector.get_view_names(schema) + extra = self.get_extra() + medatada_cache_timeout = extra.get('metadata_cache_timeout', {}) + table_cache_timeout = medatada_cache_timeout.get('table_cache_timeout') + enable_cache = 'table_cache_timeout' in medatada_cache_timeout + views = self.db_engine_spec.get_view_names( + inspector=self.inspector, + db_id=self.id, + schema=schema, + enable_cache=enable_cache, + cache_timeout=table_cache_timeout, + force=force) except Exception: pass return views diff --git a/superset/views/core.py b/superset/views/core.py index 05ef4315e28ad..00288b21bc477 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -206,7 +206,8 @@ class DatabaseView(SupersetModelView, DeleteMixin, YamlExportMixin): # noqa '#sqlalchemy.schema.MetaData) call.
' '2. The ``metadata_cache_timeout`` is a cache timeout setting ' 'in seconds for metadata fetch of this database. Specify it as ' - '**"metadata_cache_timeout": {"schema_cache_timeout": 600}**. ' + '**"metadata_cache_timeout": {"schema_cache_timeout": 600, ' + '"table_cache_timeout": 600}**. ' 'If unset, cache will not be enabled for the functionality. ' 'A timeout of 0 indicates that the cache never expires.
' '3. The ``schemas_allowed_for_csv_upload`` is a comma separated list ' @@ -1538,7 +1539,7 @@ def checkbox(self, model_view, id_, attr, value): @has_access_api @expose('/schemas//') @expose('/schemas///') - def schemas(self, db_id, force_refresh='true'): + def schemas(self, db_id, force_refresh='false'): db_id = int(db_id) force_refresh = force_refresh.lower() == 'true' database = ( @@ -1556,16 +1557,18 @@ def schemas(self, db_id, force_refresh='true'): @api @has_access_api @expose('/tables////') - def tables(self, db_id, schema, substr): + @expose('/tables/////') + def tables(self, db_id, schema, substr, force_refresh='false'): """Endpoint to fetch the list of tables for given database""" db_id = int(db_id) + force_refresh = force_refresh.lower() == 'true' schema = utils.js_string_to_python(schema) substr = utils.js_string_to_python(substr) database = db.session.query(models.Database).filter_by(id=db_id).one() table_names = security_manager.accessible_by_user( - database, database.all_table_names(schema), schema) + database, database.all_table_names(schema, force_refresh), schema) view_names = security_manager.accessible_by_user( - database, database.all_view_names(schema), schema) + database, database.all_view_names(schema, force_refresh), schema) if substr: table_names = [tn for tn in table_names if substr in tn] From 2d88ec3eb2366fea911eb392f3175ea91e5d4c53 Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Thu, 11 Oct 2018 17:09:59 -0700 Subject: [PATCH 2/6] wording --- superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx index 84f6aada540d0..b9793babf98f5 100644 --- a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx @@ -198,7 +198,7 @@ class SqlEditorLeftBar extends React.PureComponent {
From 69f131af764e6372e68622dbe723894a42dc4ab5 Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Thu, 11 Oct 2018 19:14:36 -0700 Subject: [PATCH 3/6] flake8 --- superset/db_engine_specs.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index acab2ed925320..0f3a4c8a0864c 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -316,8 +316,7 @@ def get_schema_names(cls, inspector, db_id, enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( - db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) - ) + db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, enable_cache, cache_timeout, force=False): return sorted(inspector.get_table_names(schema)) @@ -327,8 +326,7 @@ def get_table_names(cls, inspector, db_id, schema, enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:view_list'.format( - db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) - ) + db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_view_names(cls, inspector, db_id, schema, enable_cache, cache_timeout, force=False): return sorted(inspector.get_view_names(schema)) @@ -460,8 +458,7 @@ class PostgresEngineSpec(PostgresBaseEngineSpec): enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( - db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) - ) + db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, enable_cache, cache_timeout, force=False): """Need to consider foreign tables for PostgreSQL""" @@ -625,8 +622,7 @@ def convert_dttm(cls, target_type, dttm): enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( - db_id=kwargs.get('db_id'), schema=kwargs.get('schema')) - ) + db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, enable_cache, cache_timeout, force=False): """Need to disregard the schema for Sqlite""" From 0725e5f22d17c2c02b4a1fd72202ee6b90d8d87c Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Fri, 12 Oct 2018 11:40:42 -0700 Subject: [PATCH 4/6] javascript test --- .../spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx | 10 +++------- .../assets/src/SqlLab/components/SqlEditorLeftBar.jsx | 5 +---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/superset/assets/spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx b/superset/assets/spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx index b5f01873847a6..08fa24af8f89c 100644 --- a/superset/assets/spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx +++ b/superset/assets/spec/javascripts/sqllab/SqlEditorLeftBar_spec.jsx @@ -41,14 +41,10 @@ describe('SqlEditorLeftBar', () => { expect(wrapper.find(TableElement)).toHaveLength(1); }); describe('onDatabaseChange', () => { - it('should fetch tables', () => { - sinon.stub(wrapper.instance(), 'fetchTables'); + it('should fetch schemas', () => { sinon.stub(wrapper.instance(), 'fetchSchemas'); wrapper.instance().onDatabaseChange({ value: 1, label: 'main' }); - - expect(wrapper.instance().fetchTables.getCall(0).args[0]).toBe(1); expect(wrapper.instance().fetchSchemas.getCall(0).args[0]).toBe(1); - wrapper.instance().fetchTables.restore(); wrapper.instance().fetchSchemas.restore(); }); it('should clear tableOptions', () => { @@ -103,9 +99,9 @@ describe('SqlEditorLeftBar', () => { d.resolve(tables); return d.promise(); }); - wrapper.instance().fetchTables(1, 'main', 'birth_names'); + wrapper.instance().fetchTables(1, 'main', 'true', 'birth_names'); - expect(ajaxStub.getCall(0).args[0]).toBe('/superset/tables/1/main/birth_names/'); + expect(ajaxStub.getCall(0).args[0]).toBe('/superset/tables/1/main/birth_names/true/'); expect(wrapper.state().tableLength).toBe(3); }); it('should handle error', () => { diff --git a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx index b9793babf98f5..97e392c7d2efe 100644 --- a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx @@ -67,11 +67,8 @@ class SqlEditorLeftBar extends React.PureComponent { resetState() { this.props.actions.resetState(); } - fetchTables(dbId, schema, force) { + fetchTables(dbId, schema, force, substr) { // This can be large so it shouldn't be put in the Redux store - // This function has never been called with substr param so we just - // assign null to substr and have it passed to the endpoint. - const substr = null; const forceRefresh = force || false; if (dbId && schema) { this.setState({ tableLoading: true, tableOptions: [] }); From 488bdff3b9fceec9db1e816d2b4e42a320710214 Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Mon, 15 Oct 2018 12:18:00 -0700 Subject: [PATCH 5/6] address comments --- .../SqlLab/components/SqlEditorLeftBar.jsx | 7 ++--- superset/cache_util.py | 31 +++++++------------ superset/db_engine_specs.py | 16 ---------- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx index 97e392c7d2efe..e6e7f5dd26f86 100644 --- a/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx +++ b/superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx @@ -40,8 +40,7 @@ class SqlEditorLeftBar extends React.PureComponent { } onDatabaseChange(db, force) { const val = db ? db.value : null; - this.setState({ schemaOptions: [] }); - this.setState({ tableOptions: [] }); + this.setState({ schemaOptions: [], tableOptions: [] }); this.props.actions.queryEditorSetSchema(this.props.queryEditor, null); this.props.actions.queryEditorSetDb(this.props.queryEditor, val); if (db) { @@ -195,7 +194,7 @@ class SqlEditorLeftBar extends React.PureComponent { @@ -244,7 +243,7 @@ class SqlEditorLeftBar extends React.PureComponent { diff --git a/superset/cache_util.py b/superset/cache_util.py index 12bed2b18070f..38516a6a50f77 100644 --- a/superset/cache_util.py +++ b/superset/cache_util.py @@ -9,25 +9,17 @@ def view_cache_key(*unused_args, **unused_kwargs): return 'view/{}/{}'.format(request.path, args_hash) -def default_timeout(*unused_args, **unused_kwargs): - return 5 * 60 - - -def default_enable_cache(*unused_args, **unused_kwargs): - return True +def memoized_func(key=view_cache_key, use_tables_cache=False): + """Use this decorator to cache functions that have predefined first arg. + enable_cache is treated as True by default, + except enable_cache = False is passed to the decorated function. -def memoized_func(timeout=default_timeout, - key=view_cache_key, - enable_cache=default_enable_cache, - use_tables_cache=False): - """Use this decorator to cache functions that have predefined first arg. + force is treated as False by default, + except force = True is passed to the decorated function. - If enable_cache() is False, - the function will never be cached. - If enable_cache() is True, - cache is adopted and will timeout in timeout() seconds. - If force is True, cache will be refreshed. + timeout of cache is set to 600 seconds by default, + except cache_timeout = {timeout in seconds} is passed to the decorated function. memoized_func uses simple_cache and stored the data in memory. Key is a callable function that takes function arguments and @@ -42,15 +34,16 @@ def wrap(f): if selected_cache: def wrapped_f(cls, *args, **kwargs): - if not enable_cache(*args, **kwargs): + if not kwargs.get('enable_cache', True): return f(cls, *args, **kwargs) cache_key = key(*args, **kwargs) o = selected_cache.get(cache_key) - if not kwargs['force'] and o is not None: + if not kwargs.get('force') and o is not None: return o o = f(cls, *args, **kwargs) - selected_cache.set(cache_key, o, timeout=timeout(*args, **kwargs)) + selected_cache.set(cache_key, o, + timeout=kwargs.get('cache_timeout', 600)) return o else: # noop diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 0f3a4c8a0864c..20d57d6976612 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -228,7 +228,6 @@ def convert_dttm(cls, target_type, dttm): @classmethod @cache_util.memoized_func( - timeout=600, key=lambda *args, **kwargs: 'db:{}:{}'.format(args[0].id, args[1]), use_tables_cache=True) def fetch_result_sets(cls, db, datasource_type, force=False): @@ -295,8 +294,6 @@ def patch(cls): @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{}:schema_list'.format(kwargs.get('db_id'))) def get_schema_names(cls, inspector, db_id, enable_cache, cache_timeout, force=False): @@ -313,8 +310,6 @@ def get_schema_names(cls, inspector, db_id, @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, @@ -323,8 +318,6 @@ def get_table_names(cls, inspector, db_id, schema, @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:view_list'.format( db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_view_names(cls, inspector, db_id, schema, @@ -455,8 +448,6 @@ class PostgresEngineSpec(PostgresBaseEngineSpec): @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, @@ -592,7 +583,6 @@ def epoch_to_dttm(cls): @classmethod @cache_util.memoized_func( - timeout=600, key=lambda *args, **kwargs: 'db:{}:{}'.format(args[0].id, args[1]), use_tables_cache=True) def fetch_result_sets(cls, db, datasource_type, force=False): @@ -619,8 +609,6 @@ def convert_dttm(cls, target_type, dttm): @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{db_id}:schema:{schema}:table_list'.format( db_id=kwargs.get('db_id'), schema=kwargs.get('schema'))) def get_table_names(cls, inspector, db_id, schema, @@ -749,7 +737,6 @@ def epoch_to_dttm(cls): @classmethod @cache_util.memoized_func( - timeout=600, key=lambda *args, **kwargs: 'db:{}:{}'.format(args[0].id, args[1]), use_tables_cache=True) def fetch_result_sets(cls, db, datasource_type, force=False): @@ -1031,7 +1018,6 @@ def patch(cls): @classmethod @cache_util.memoized_func( - timeout=600, key=lambda *args, **kwargs: 'db:{}:{}'.format(args[0].id, args[1]), use_tables_cache=True) def fetch_result_sets(cls, db, datasource_type, force=False): @@ -1489,8 +1475,6 @@ def convert_dttm(cls, target_type, dttm): @classmethod @cache_util.memoized_func( - enable_cache=lambda *args, **kwargs: kwargs.get('enable_cache', False), - timeout=lambda *args, **kwargs: kwargs.get('cache_timeout'), key=lambda *args, **kwargs: 'db:{}:schema_list'.format(kwargs.get('db_id'))) def get_schema_names(cls, inspector, db_id, enable_cache, cache_timeout, force=False): From c14749749ec058c1f44f6ba4fc78d319860fbc37 Mon Sep 17 00:00:00 2001 From: Junda Yang Date: Mon, 15 Oct 2018 12:21:46 -0700 Subject: [PATCH 6/6] nit --- superset/cache_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/cache_util.py b/superset/cache_util.py index 38516a6a50f77..843ffdb0e84a5 100644 --- a/superset/cache_util.py +++ b/superset/cache_util.py @@ -15,7 +15,7 @@ def memoized_func(key=view_cache_key, use_tables_cache=False): enable_cache is treated as True by default, except enable_cache = False is passed to the decorated function. - force is treated as False by default, + force means whether to force refresh the cache and is treated as False by default, except force = True is passed to the decorated function. timeout of cache is set to 600 seconds by default,