mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
feat(SIP-95): new endpoint for table metadata (#28122)
This commit is contained in:
@@ -56,7 +56,7 @@ class TestPrestoValidator(SupersetTestCase):
|
||||
sql = "SELECT 1 FROM default.notarealtable"
|
||||
schema = "default"
|
||||
|
||||
errors = self.validator.validate(sql, schema, self.database)
|
||||
errors = self.validator.validate(sql, None, schema, self.database)
|
||||
|
||||
self.assertEqual([], errors)
|
||||
|
||||
@@ -70,7 +70,7 @@ class TestPrestoValidator(SupersetTestCase):
|
||||
fetch_fn.side_effect = DatabaseError("dummy db error")
|
||||
|
||||
with self.assertRaises(PrestoSQLValidationError):
|
||||
self.validator.validate(sql, schema, self.database)
|
||||
self.validator.validate(sql, None, schema, self.database)
|
||||
|
||||
@patch("superset.utils.core.g")
|
||||
def test_validator_unexpected_error(self, flask_g):
|
||||
@@ -82,7 +82,7 @@ class TestPrestoValidator(SupersetTestCase):
|
||||
fetch_fn.side_effect = Exception("a mysterious failure")
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
self.validator.validate(sql, schema, self.database)
|
||||
self.validator.validate(sql, None, schema, self.database)
|
||||
|
||||
@patch("superset.utils.core.g")
|
||||
def test_validator_query_error(self, flask_g):
|
||||
@@ -93,7 +93,7 @@ class TestPrestoValidator(SupersetTestCase):
|
||||
fetch_fn = self.database.db_engine_spec.fetch_data
|
||||
fetch_fn.side_effect = DatabaseError(self.PRESTO_ERROR_TEMPLATE)
|
||||
|
||||
errors = self.validator.validate(sql, schema, self.database)
|
||||
errors = self.validator.validate(sql, None, schema, self.database)
|
||||
|
||||
self.assertEqual(1, len(errors))
|
||||
|
||||
@@ -105,7 +105,10 @@ class TestPostgreSQLValidator(SupersetTestCase):
|
||||
|
||||
mock_database = MagicMock()
|
||||
annotations = PostgreSQLValidator.validate(
|
||||
sql='SELECT 1, "col" FROM "table"', schema="", database=mock_database
|
||||
sql='SELECT 1, "col" FROM "table"',
|
||||
catalog=None,
|
||||
schema="",
|
||||
database=mock_database,
|
||||
)
|
||||
assert annotations == []
|
||||
|
||||
@@ -115,7 +118,10 @@ class TestPostgreSQLValidator(SupersetTestCase):
|
||||
|
||||
mock_database = MagicMock()
|
||||
annotations = PostgreSQLValidator.validate(
|
||||
sql='SELECT 1, "col"\nFROOM "table"', schema="", database=mock_database
|
||||
sql='SELECT 1, "col"\nFROOM "table"',
|
||||
catalog=None,
|
||||
schema="",
|
||||
database=mock_database,
|
||||
)
|
||||
|
||||
assert len(annotations) == 1
|
||||
|
||||
Reference in New Issue
Block a user