def test_parse_sql_single_statement(app_context: AppContext) -> None: """ `parse_sql` should properly strip leading and trailing spaces and semicolons """ from superset.db_engine_specs.base import BaseEngineSpec queries = BaseEngineSpec.parse_sql(" SELECT foo FROM tbl ; ") assert queries == ["SELECT foo FROM tbl"]
def test_parse_sql_multi_statement(app_context: AppContext) -> None: """ For string with multiple SQL-statements `parse_sql` method should return list where each element represents the single SQL-statement """ from superset.db_engine_specs.base import BaseEngineSpec queries = BaseEngineSpec.parse_sql("SELECT foo FROM tbl1; SELECT bar FROM tbl2;") assert queries == [ "SELECT foo FROM tbl1", "SELECT bar FROM tbl2", ]