【问题标题】:How to make GCP Data Fusion MySQL Replication work well with DateTime columns如何使 GCP 数据融合 MySQL 复制与 DateTime 列一起工作
【发布时间】:2021-07-03 07:47:50
【问题描述】:

通过关注this article on Cloud Data Fusion Replication,我成功地将 MySQL 表复制到 BigQuery 中相当容易。但是,DateTime 列存在问题。所有 DateTime 列都已使用 1970 年的日期复制到 BigQuery 中。有谁知道如何解决这个问题?

这里是原始 MySQL 数据:
这是 BigQuery 中的复制数据

【问题讨论】:

  • 请问您的 MySQL 和 BigQuery 表中使用了哪些数据类型?最近在 6.4 中添加了对 CDAP 的 DateTime 支持(直接转换),并且尚未在复制中实现正确的转换。在 this issue 中跟踪了在复制中支持 BigQuery DateTime 转换的工作。
  • 非常感谢@DennisLi! mysql 列是 DateTime(3),BigQuery 列自动生成为 TimeStamp。

标签: mysql google-cloud-platform google-bigquery replication google-cloud-data-fusion


【解决方案1】:

我想出了另一种方法。您可以通过创建自己的批处理管道来模拟 MySQL 复制到 BigQuery,然后安排该管道以您想要的频率运行。 MySQL 设置很容易做到。只需关注the instructions to install the MySQL driver here。 然后设置 MySQL 数据源和 BigQuery Sink。 MySQL 中的DateTime 列应标记为TimeStamps,BigQuery 中它们对应的列必须是DateTime 类型

MySQL 数据源配置

BigQuery 接收器配置

最后,您可以在 MySQL Source 之前执行 BigQuery Execution Action,以获取您复制的最新记录的 id 或时间。

【讨论】:

    猜你喜欢
    • 2022-10-18
    • 2017-09-26
    • 1970-01-01
    • 2021-07-22
    • 1970-01-01
    • 1970-01-01
    • 2019-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多