4
當我嘗試列出項目中的數據集時(通過service.Datasets.List),我從BigQuery中收到「Insufficient Permissions」異常。我必須做些什麼才能授予此權限?全F#源代碼:來自BigQuery API的權限不足例外
open System
open System.IO
open System.Threading
open Google.Apis.Auth.OAuth2
open Google.Apis.Bigquery.v2
open Google.Apis.Bigquery.v2.Data
open Google.Apis.Services
let private service =
let credential =
let secrets =
use stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read)
GoogleClientSecrets.Load(stream).Secrets
let task =
GoogleWebAuthorizationBroker.AuthorizeAsync(
secrets,
[| BigqueryService.Scope.Bigquery |],
"user",
CancellationToken.None)
printfn "Authenticating"
task
|> Async.AwaitTask
|> Async.RunSynchronously
let initializer = new BaseClientService.Initializer(HttpClientInitializer = credential)
new BigqueryService(initializer)
[<EntryPoint>]
let main argv =
let projectId = "{MyProjectId}"
let list = service.Datasets.List(projectId).Execute()
for dataset in list.Datasets do
printfn "%A" dataset.FriendlyName
0
非常高興看到F#中的bigquery用戶編碼。 「權限不足」可能意味着您的請求在請求提前(在進入bigquery後端之前)被拒絕。有可能你的項目沒有啓用bigquery。是否還提供了有關該錯誤的更多信息? – 2014-12-02 02:15:17