changeSchema({ value: schema }, true)}
tooltipContent={t('Force refresh table list')}
/>
);
-
return renderSelectRow(select, refresh);
}
+ function renderSeeTableLabel() {
+ return (
+
+
+ {t('See table schema')}{' '}
+ {schema && (
+
+ {tableOptions.length} in {schema}
+
+ )}
+
+
+ );
+ }
+
return (
{renderDatabaseSelector()}
- {sqlLabMode && !formMode && }
+ {!formMode && }
+ {sqlLabMode && renderSeeTableLabel()}
+ {formMode && {t('Table')}}
{renderTableSelect()}
);
diff --git a/superset-frontend/src/components/WarningIconWithTooltip/index.tsx b/superset-frontend/src/components/WarningIconWithTooltip/index.tsx
index f732554e15..f160ade50e 100644
--- a/superset-frontend/src/components/WarningIconWithTooltip/index.tsx
+++ b/superset-frontend/src/components/WarningIconWithTooltip/index.tsx
@@ -18,17 +18,16 @@
*/
import React from 'react';
import { useTheme, SafeMarkdown } from '@superset-ui/core';
-import Icons, { IconType } from 'src/components/Icons';
+import Icons from 'src/components/Icons';
import { Tooltip } from 'src/components/Tooltip';
export interface WarningIconWithTooltipProps {
warningMarkdown: string;
- size?: IconType['iconSize'];
+ size?: number;
}
function WarningIconWithTooltip({
warningMarkdown,
- size,
}: WarningIconWithTooltipProps) {
const theme = useTheme();
return (
@@ -38,7 +37,6 @@ function WarningIconWithTooltip({
>
diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx
index d8a0a3425f..e11b8310bb 100644
--- a/superset-frontend/src/datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/datasource/DatasourceEditor.jsx
@@ -775,47 +775,41 @@ class DatasourceEditor extends React.PureComponent {
{this.state.isSqla && (
<>
-
-
-
- this.state.isEditMode &&
- this.onDatasourcePropChange('schema', schema)
- }
- onDbChange={database =>
- this.state.isEditMode &&
- this.onDatasourcePropChange('database', database)
- }
- formMode={false}
- handleError={this.props.addDangerToast}
- readOnly={!this.state.isEditMode}
- />
-
- }
- />
-
- {
- this.onDatasourcePropChange('table_name', table);
- }}
- placeholder={t('Dataset name')}
- disabled={!this.state.isEditMode}
- />
+
+ this.state.isEditMode &&
+ this.onDatasourcePropChange('schema', schema)
}
+ onDbChange={database =>
+ this.state.isEditMode &&
+ this.onDatasourcePropChange('database', database)
+ }
+ formMode={false}
+ handleError={this.props.addDangerToast}
+ readOnly={!this.state.isEditMode}
/>
-
-
+ }
+ />
+ {
+ this.onDatasourcePropChange('table_name', table);
+ }}
+ placeholder={t('Dataset name')}
+ disabled={!this.state.isEditMode}
+ />
+ }
+ />
-
- this.onDatasourcePropChange('schema', schema)
- : undefined
- }
- onDbChange={
- this.state.isEditMode
- ? database =>
- this.onDatasourcePropChange(
- 'database',
- database,
- )
- : undefined
- }
- onTableChange={
- this.state.isEditMode
- ? table =>
- this.onDatasourcePropChange('table_name', table)
- : undefined
- }
- readOnly={!this.state.isEditMode}
- />
-
+
+ this.onDatasourcePropChange('schema', schema)
+ : undefined
+ }
+ onDbChange={
+ this.state.isEditMode
+ ? database =>
+ this.onDatasourcePropChange('database', database)
+ : undefined
+ }
+ onTableChange={
+ this.state.isEditMode
+ ? table =>
+ this.onDatasourcePropChange('table_name', table)
+ : undefined
+ }
+ readOnly={!this.state.isEditMode}
+ />
}
description={t(
'The pointer to a physical table (or view). Keep in mind that the chart is ' +
diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
index 3df55323d1..9278c29e79 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
@@ -227,7 +227,10 @@ class DatasourceControl extends React.PureComponent {
)}
{extra?.warning_markdown && (
-
+
)}
= ({
)}
{parsedExtra?.warning_markdown && (
)}
{titleLink}
diff --git a/superset/datasets/api.py b/superset/datasets/api.py
index 261a7d749e..8d8eb6efee 100644
--- a/superset/datasets/api.py
+++ b/superset/datasets/api.py
@@ -160,7 +160,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
"url",
"extra",
]
- show_columns = show_select_columns + ["columns.type_generic", "database.backend"]
+ show_columns = show_select_columns + ["columns.type_generic"]
add_model_schema = DatasetPostSchema()
edit_model_schema = DatasetPutSchema()
add_columns = ["database", "schema", "table_name", "owners"]
diff --git a/superset/views/core.py b/superset/views/core.py
index 29109f13c3..d7e626e261 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1058,14 +1058,8 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
@event_logger.log_this
@expose("/tables////")
@expose("/tables/////")
- @expose("/tables/////")
- def tables( # pylint: disable=too-many-locals,no-self-use,too-many-arguments
- self,
- db_id: int,
- schema: str,
- substr: str,
- force_refresh: str = "false",
- exact_match: str = "false",
+ def tables( # pylint: disable=too-many-locals,no-self-use
+ self, db_id: int, schema: str, substr: str, force_refresh: str = "false"
) -> FlaskResponse:
"""Endpoint to fetch the list of tables for given database"""
# Guarantees database filtering by security access
@@ -1078,7 +1072,6 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
return json_error_response("Not found", 404)
force_refresh_parsed = force_refresh.lower() == "true"
- exact_match_parsed = exact_match.lower() == "true"
schema_parsed = utils.parse_js_uri_path_item(schema, eval_undefined=True)
substr_parsed = utils.parse_js_uri_path_item(substr, eval_undefined=True)
@@ -1120,15 +1113,9 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
ds_name.table if schema_parsed else f"{ds_name.schema}.{ds_name.table}"
)
- def is_match(src: str, target: utils.DatasourceName) -> bool:
- target_label = get_datasource_label(target)
- if exact_match_parsed:
- return src == target_label
- return src in target_label
-
if substr_parsed:
- tables = [tn for tn in tables if is_match(substr_parsed, tn)]
- views = [vn for vn in views if is_match(substr_parsed, vn)]
+ tables = [tn for tn in tables if substr_parsed in get_datasource_label(tn)]
+ views = [vn for vn in views if substr_parsed in get_datasource_label(vn)]
if not schema_parsed and database.default_schemas:
user_schemas = (
diff --git a/tests/integration_tests/datasets/api_tests.py b/tests/integration_tests/datasets/api_tests.py
index c9701534b2..385025e383 100644
--- a/tests/integration_tests/datasets/api_tests.py
+++ b/tests/integration_tests/datasets/api_tests.py
@@ -222,7 +222,6 @@ class TestDatasetApi(SupersetTestCase):
Dataset API: Test get dataset item
"""
table = self.get_energy_usage_dataset()
- main_db = get_main_database()
self.login(username="admin")
uri = f"api/v1/dataset/{table.id}"
rv = self.get_assert_metric(uri, "get")
@@ -230,11 +229,7 @@ class TestDatasetApi(SupersetTestCase):
response = json.loads(rv.data.decode("utf-8"))
expected_result = {
"cache_timeout": None,
- "database": {
- "backend": main_db.backend,
- "database_name": "examples",
- "id": 1,
- },
+ "database": {"database_name": "examples", "id": 1},
"default_endpoint": None,
"description": "Energy consumption",
"extra": None,
@@ -249,10 +244,9 @@ class TestDatasetApi(SupersetTestCase):
"table_name": "energy_usage",
"template_params": None,
}
- if response["result"]["database"]["backend"] not in ("presto", "hive"):
- assert {
- k: v for k, v in response["result"].items() if k in expected_result
- } == expected_result
+ assert {
+ k: v for k, v in response["result"].items() if k in expected_result
+ } == expected_result
assert len(response["result"]["columns"]) == 3
assert len(response["result"]["metrics"]) == 2