【问题标题】:Read the data from Google Cloud Sql to BigQuery using Clud Dataflow使用 Clud Dataflow 将数据从 Google Cloud Sql 读取到 BigQuery
【发布时间】:2020-09-17 10:21:03
【问题描述】:

我们实际上计划使用 CloudDataflow 将 CloudSql 中的数据读入 BigQuery。当我尝试运行下面提到的代码时,我收到错误消息“未提供驱动程序类名”。

https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/master/src/main/java/com/google/cloud/teleport/templates/JdbcToBigQuery.java

有人知道如何为这行代码“options.getDriverClassName()”传递值吗?

【问题讨论】:

  • 你的问题是在DriverClassName选项中设置什么?
  • 您是否对 JDBC 和 BigQuery 之间的数据进行了大量转换?您的 Cloud SQL 数据库引擎是什么?

标签: java google-cloud-platform


【解决方案1】:

@Panciz,@guillaume blaquiere

我自己找到了解决方案。如果您从 Google 查看以下链接

https://cloud.google.com/dataflow/docs/guides/templates/provided-batch#java-database-connectivity-jdbc-to-bigquery

我们需要传递上面链接中提到的参数。因为,我正在从 IntelliJ 运行“JdbcToBigQuery”数据流模板,所以我将这些参数作为 Program Arguments 传递,如下所述,它起作用了。

--project=<google cloud project name>
--stagingLocation=gs://<location>
--gcpTempLocation=gs://<location>
--serviceAccount=<service account for dataflow>
--runner=DirectRunner
--driverJars=gs://<location>/postgres-socket-factory-1.0.15-jar-with-dependencies.jar
--bigQueryLoadingTemporaryDirectory=gs://<location>
--driverClassName=org.postgresql.Driver
--connectionURL=jdbc:postgresql://google/<your google cloud  postgres db name>?cloudSqlInstance=<your google cloud project name>:europe-west1:<your google cloud  postgres instance name>&socketFactory=com.google.cloud.sql.postgres.SocketFactory&useSSL=false
--username=<your username>
--password=<your passsowrd>
--query="<your sql query>"
--outputTable=<your google cloud  project name>:<your google cloud dataset name>.<your google cloud table name>
--connectionProperties=unicode=true&characterEncoding=UTF-8

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-25
    • 2017-12-14
    • 2020-11-11
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多