in awswrangler/timestream/_read.py [0:0]
def _cast_value(value: str, dtype: str) -> Any: # noqa: PLR0911
if dtype == "VARCHAR":
return value
if dtype in ("INTEGER", "BIGINT"):
return int(value)
if dtype == "DOUBLE":
return float(value)
if dtype == "BOOLEAN":
return value.lower() == "true"
if dtype == "TIMESTAMP":
return datetime.strptime(value[:-3], "%Y-%m-%d %H:%M:%S.%f")
if dtype == "DATE":
return datetime.strptime(value, "%Y-%m-%d").date()
if dtype == "TIME":
return datetime.strptime(value[:-3], "%H:%M:%S.%f").time()
if dtype == "ARRAY":
return str(value)
raise ValueError(f"Not supported Amazon Timestream type: {dtype}")