繁体   English   中英

使用 Clud Dataflow 将数据从 Google Cloud Sql 读取到 BigQuery

[英]Read the data from Google Cloud Sql to BigQuery using Clud Dataflow

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

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

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

@Panciz,@guillaume blaquiere

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

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

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

--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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM