giftig commented on code in PR #25950: URL: https://github.com/apache/superset/pull/25950#discussion_r1390800754
########## superset/jinja_context.py: ########## @@ -486,6 +487,26 @@ def process_template(self, sql: str, **kwargs: Any) -> str: class JinjaTemplateProcessor(BaseTemplateProcessor): + def _parse_datetime(self, dttm: Optional[str]) -> Optional[datetime]: + """ + Try to parse a datetime and default to None in the worst case. + + Since this may have been rendered by different engines, the datetime may + vary slightly in format. We try to make it consistent, and if all else + fails, just return None. + """ + if not dttm: Review Comment: done ########## superset/jinja_context.py: ########## @@ -486,6 +487,26 @@ def process_template(self, sql: str, **kwargs: Any) -> str: class JinjaTemplateProcessor(BaseTemplateProcessor): + def _parse_datetime(self, dttm: Optional[str]) -> Optional[datetime]: + """ + Try to parse a datetime and default to None in the worst case. + + Since this may have been rendered by different engines, the datetime may + vary slightly in format. We try to make it consistent, and if all else + fails, just return None. + """ + if not dttm: + return None + + dttm_format = "%Y-%m-%dT%H:%M:%S.%f" Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
