def METHOD_NAME(
    cls, target_type: str, dttm: datetime, db_extra: Optional[dict[str, Any]] = None
) -> Optional[str]:
    sqla_type = cls.get_sqla_column_type(target_type)
    if isinstance(sqla_type, types.Date):
        return f"CAST('{dttm.date().isoformat()}' AS DATE)"
    if isinstance(sqla_type, types.TIMESTAMP):
        return f"""CAST('{dttm.isoformat(timespec="microseconds")}' AS TIMESTAMP)"""
    return None