在尝试使用 Simba 驱动程序将数据帧写入 Bigquery 时。我得到以下异常。下面是数据框。在 bigquery 中创建了一个具有相同架构的表。
df.printSchema
root
|-- empid: integer (nullable = true)
|-- firstname: string (nullable = true)
|-- middle: string (nullable = true)
|-- last: string (nullable = true)
|-- gender: string (nullable = true)
|-- age: double (nullable = true)
|-- weight: integer (nullable = true)
|-- salary: integer (nullable = true)
|-- city: string (nullable = true)
Simba 驱动程序抛出以下错误
Caused by: com.simba.googlebigquery.support.exceptions.GeneralException: [Simba][BigQueryJDBCDriver](100032) Error executing query job. Message: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "q",
"locationType" : "parameter",
"message" : "Syntax error: Unexpected string literal \"empid\" at [1:38]",
"reason" : "invalidQuery"
} ],
"message" : "Syntax error: Unexpected string literal \"empid\" at [1:38]",
"status" : "INVALID_ARGUMENT"
}
... 24 more
下面是我使用的代码:
val url = "jdbc:bigquery://https://www.googleapis.com/bigquery/v2;ProjectId=my_project_id;OAuthType=0;OAuthPvtKeyPath=service_account_jsonfile;OAuthServiceAcctEmail=googleaccount"
df.write.mode(SaveMode.Append).jdbc(url,"orders_dataset.employee",new java.util.Properties)
请让我知道是否缺少任何其他配置或哪里出错了。提前致谢!