You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amolsr (via GitHub)" <gi...@apache.org> on 2023/05/12 05:27:08 UTC
[GitHub] [airflow] amolsr commented on a diff in pull request #31206: Add default value to data columns in SQLtoS3Operator
amolsr commented on code in PR #31206:
URL: https://github.com/apache/airflow/pull/31206#discussion_r1191920099
##########
airflow/providers/amazon/aws/transfers/sql_to_s3.py:
##########
@@ -148,9 +148,13 @@ def _fix_dtypes(df: DataFrame, file_format: FILE_FORMAT) -> None:
for col in df:
if df[col].dtype.name == "object" and file_format == "parquet":
- # if the type wasn't identified or converted, change it to a string so if can still be
- # processed.
- df[col] = df[col].astype(str)
+ # if the type wasn't identified or converted, try parsing it to datetime
+ try:
+ df[col] = pd.to_datetime(df[col])
Review Comment:
None values can be parsed to strings, but when encountered in the datetime column, it will make the data invalid and not parseable in the following tasks.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org