mirror of https://github.com/apache/superset.git
fix: datetime value should be seconds in sqlite (#21113)
This commit is contained in:
parent
1ffa5670b3
commit
1afcdfb9fa
|
@ -110,7 +110,7 @@ class SqliteEngineSpec(BaseEngineSpec):
|
|||
) -> Optional[str]:
|
||||
tt = target_type.upper()
|
||||
if tt in (utils.TemporalType.TEXT, utils.TemporalType.DATETIME):
|
||||
return f"""'{dttm.isoformat(sep=" ", timespec="microseconds")}'"""
|
||||
return f"""'{dttm.isoformat(sep=" ", timespec="seconds")}'"""
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -27,13 +27,13 @@ from tests.unit_tests.fixtures.common import dttm
|
|||
def test_convert_dttm(dttm: datetime) -> None:
|
||||
from superset.db_engine_specs.sqlite import SqliteEngineSpec
|
||||
|
||||
assert SqliteEngineSpec.convert_dttm("TEXT", dttm) == "'2019-01-02 03:04:05.678900'"
|
||||
assert SqliteEngineSpec.convert_dttm("TEXT", dttm) == "'2019-01-02 03:04:05'"
|
||||
|
||||
|
||||
def test_convert_dttm_lower(dttm: datetime) -> None:
|
||||
from superset.db_engine_specs.sqlite import SqliteEngineSpec
|
||||
|
||||
assert SqliteEngineSpec.convert_dttm("text", dttm) == "'2019-01-02 03:04:05.678900'"
|
||||
assert SqliteEngineSpec.convert_dttm("text", dttm) == "'2019-01-02 03:04:05'"
|
||||
|
||||
|
||||
def test_convert_dttm_invalid_type(dttm: datetime) -> None:
|
||||
|
|
Loading…
Reference in New Issue