Ejemplo n.º 1
0
def test_convert_dttm(dttm: datetime) -> None:
    """
    Test that date objects are converted correctly.
    """

    from superset.db_engine_specs.athena import AthenaEngineSpec

    assert AthenaEngineSpec.convert_dttm("DATE", dttm) == "DATE '2019-01-02'"

    assert (AthenaEngineSpec.convert_dttm(
        "TIMESTAMP", dttm) == "TIMESTAMP '2019-01-02 03:04:05.678'")
Ejemplo n.º 2
0
    def test_convert_dttm(self):
        dttm = self.get_dttm()

        self.assertEqual(
            AthenaEngineSpec.convert_dttm("DATE", dttm),
            "from_iso8601_date('2019-01-02')",
        )

        self.assertEqual(
            AthenaEngineSpec.convert_dttm("TIMESTAMP", dttm),
            "from_iso8601_timestamp('2019-01-02T03:04:05.678900')",
        )
Ejemplo n.º 3
0
def test_convert_dttm(app_context: AppContext, dttm: datetime) -> None:
    """
    Test that date objects are converted correctly.
    """

    from superset.db_engine_specs.athena import AthenaEngineSpec

    assert (AthenaEngineSpec.convert_dttm(
        "DATE", dttm) == "from_iso8601_date('2019-01-02')")

    assert (AthenaEngineSpec.convert_dttm(
        "TIMESTAMP",
        dttm) == "from_iso8601_timestamp('2019-01-02T03:04:05.678900')")