Repository navigation
Ensure mysql_to_gcs fully compatible with MySQL and BigQuery for datetime-related values - #15026
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
datetime-related values fully compatible with MySQL and BigQuerymysql_to_gcs fully compatible with MySQL and BigQuery for datetime-related values
583369a to
0a299d5
Compare
|
Nice one! |
|
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
|
Awesome work, congrats on your first merged pull request! |
Compatibility issues for
datetime-related values:Valid data:
timedelta.total_seconds() > 86399.99999(9)?This PR implicitly raises an
OverflowError: date value out of rangewhentimedelta.total_seconds() < 0.Supported output format:
When no
schemaprovided, the current version of the operator assumes that MySQL's DATETIME and DATE values becoming BigQuery's TIMESTAMP, which doesn't accept Unix Epoch integer unless the downstreamgcs_to_bigqueryactually takes the output of_write_local_schema_file().Should there be a
schema, the current version of the operator sends integers and floats to BigQuery's DATETIME/TIMESTAMP and TIME, respectively. Issues are:calendar.timegm()will still cause troubles (unless the downstreamgcs_to_bigqueryuses a connection that switches to legacy SQL of BigQuery);As for DATE, if the
schemais indeed sent to the downstreamgcs_to_bigquery, then the current version will work. Otherwise, it will still encounter issues of BigQuery's integer-to-TIMESTAMP rejection and negative integers fromtimege()for edge cases.A side note:
I suppose some usages might have been designed for BigQuery's legacy SQL dialect. However, since
gcs_to_bigquerydoesn't explicitly support it (only one line detects it forescaped_table_name), and standard SQL dialect is the default for Python library, it might be safe to follow standard SQL dialect's requirements.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.