我有一个应用程序可以读取 CSV 文件并将其推送到 BQ 表,在执行下一个 CSV 文件之前检查该作业的状态等等。当我的数据集在美国地区时,这工作正常,但是我们最近将数据集移到了澳大利亚地区,现在我得到了
#error { :cause 404 Not Found { "code" : 404, "errors" : [ { "domain" : "global", "message" : "Not found: Job load-csv-job123", "reason" : "notFound" }
虽然我可以针对此数据集正常运行作业,但我无法在 Clojure 代码中调用 BQ get API 来获取状态。在调用插入作业 API 时,我在 jobReference 中设置位置
job-reference (doto (JobReference.) (.setLocation "australia-southeast1") (.setJobId job-id) )
然后像这样调用我的插入
status (->> bq
(.jobs)
(#(.insert % project-id job-spec content))
(.execute)
(.getStatus))]
当我这样做时,上述状态有效(->> status (.getState)
我知道我必须为非美国/非欧盟地区的某处设置位置,以便在工作中调用 GET,但只是不知道如何使用 GET API 从 Google Docs 中获取。
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get
我在下面的代码中使用的 API/jar
[com.google.apis/google-api-services-bigquery“v2-rev459-1.25.0”]
我在循环中使用 recur 获取状态的代码
(loop [status status] ;; Waiting until successfully processed
(log/info job-id " : " (->> status (.getState)))
(if (= "DONE" (->> status (.getState)))
(do (log/info "Status seems done?")
(if-let [errors (.getErrors status)]
(do
(log/info "seems like we have errors")
(vec (map #(.getMessage %) errors)))
nil))
(do
(log/info "status is pending let's wait and check...job spec" job-spec)
(Thread/sleep 3000)
(recur (->> bq
(.jobs)
(#(.get % project-id job-id))
(.execute)
(.getStatus))
))))))
你能告诉我我错过了什么吗,我在 .get 上设置位置的尝试
(#(.get % project-id job-id))(.setLocation "australia-southeast1")
回来了
CompilerException java.lang.IllegalArgumentException: No matching field found: setLocation for class java.lang.String, compiling:```