mirror of
https://github.com/apache/superset.git
synced 2026-04-17 15:15:20 +00:00
fix: Ensure table uniqueness on update (#15909)
* fix: Ensure table uniqueness on update * Update models.py * Update slice.py * Update datasource_tests.py Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
@@ -339,7 +339,7 @@ class TestDatabaseModel(SupersetTestCase):
|
||||
class TestSqlaTableModel(SupersetTestCase):
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_get_timestamp_expression(self):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
ds_col = tbl.get_column("ds")
|
||||
sqla_literal = ds_col.get_timestamp_expression(None)
|
||||
self.assertEqual(str(sqla_literal.compile()), "ds")
|
||||
@@ -359,7 +359,7 @@ class TestSqlaTableModel(SupersetTestCase):
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_get_timestamp_expression_epoch(self):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
ds_col = tbl.get_column("ds")
|
||||
|
||||
ds_col.expression = None
|
||||
@@ -384,7 +384,7 @@ class TestSqlaTableModel(SupersetTestCase):
|
||||
ds_col.expression = prev_ds_expr
|
||||
|
||||
def query_with_expr_helper(self, is_timeseries, inner_join=True):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
ds_col = tbl.get_column("ds")
|
||||
ds_col.expression = None
|
||||
ds_col.python_date_format = None
|
||||
@@ -447,7 +447,7 @@ class TestSqlaTableModel(SupersetTestCase):
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_sql_mutator(self):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
query_obj = dict(
|
||||
groupby=[],
|
||||
metrics=None,
|
||||
@@ -472,7 +472,7 @@ class TestSqlaTableModel(SupersetTestCase):
|
||||
app.config["SQL_QUERY_MUTATOR"] = None
|
||||
|
||||
def test_query_with_non_existent_metrics(self):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
|
||||
query_obj = dict(
|
||||
groupby=[],
|
||||
@@ -493,7 +493,7 @@ class TestSqlaTableModel(SupersetTestCase):
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_data_for_slices(self):
|
||||
tbl = self.get_table_by_name("birth_names")
|
||||
tbl = self.get_table(name="birth_names")
|
||||
slc = (
|
||||
metadata_db.session.query(Slice)
|
||||
.filter_by(
|
||||
|
||||
Reference in New Issue
Block a user