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