Esempio n. 1
0
            GESqlDialect.TERADATASQL: "SELECT TOP 10 * FROM TEST_SCHEMA_NAME.TEST_TABLE WHERE 1 = 1",
            GESqlDialect.TRINO: "SELECT * FROM TEST_SCHEMA_NAME.TEST_TABLE WHERE TRUE LIMIT 10",
            GESqlDialect.HIVE: "SELECT * FROM `TEST_SCHEMA_NAME`.`TEST_TABLE` WHERE TRUE LIMIT 10",
        }
        return dialect_name_to_sql_statement[dialect_name]

    return _dialect_name_to_sql_statement


@pytest.mark.parametrize(
    "dialect_name",
    [
        pytest.param(
            dialect_name, id=dialect_name.value, marks=pytest.mark.external_sqldialect
        )
        for dialect_name in GESqlDialect.get_all_dialects()
    ],
)
def test_sample_using_limit_builds_correct_query_where_clause_none(
    dialect_name: GESqlDialect, dialect_name_to_sql_statement, sa
):
    """What does this test and why?

    split_on_limit should build the appropriate query based on input parameters.
    This tests dialects that differ from the standard dialect, not each dialect exhaustively.
    """

    # 1. Setup
    class MockSqlAlchemyExecutionEngine:
        def __init__(self, dialect_name: GESqlDialect):
            self._dialect_name = dialect_name
def test_get_all_dialects_no_other_dialects():
    assert GESqlDialect.OTHER not in GESqlDialect.get_all_dialects()