有没有在Azure函数中使用Google.Cloud.BigQuery.V2(1.0.0-beta10)API的方法?在Azure函数中使用Google.Cloud.BigQuery.V2 API
我喜欢使用这个API和Azure的功能我的C#代码,但得到这个错误:
error CS0103: The name 'BigQueryClient' does not exist in the current context
error CS0246: The type or namespace name 'BigQueryTable' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'BigQueryJob' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'CreateQueryJobOptions' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'BigQueryResults' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'GetQueryResultsOptions' could not be found (are you missing a using directive or an assembly reference?)
Compilation failed.
在我project.json我有以下代码:
{
"frameworks": {
"net46":{
"dependencies": {
"Google.Cloud.BigQuery.V2": "1.0.0-beta10"
}
}
}
}
我觉得API在.NET 4.5和Azure函数需要4.6。所以似乎没有办法在自动对焦中使用这个API? 我也试过它与“net45”,但得到相同的错误。
更新:此API正在处理AF(另请参阅下面的注释)。编译成功。但是我的功能仍然没有工作,因为缺少证书。在我的Visual Studio中的代码运行,并像它应该工作,但在AF我得到了以下错误:
Exception while executing function: Functions.TimerTriggerCSharp1. mscorlib: Exception has been thrown by the target of an invocation. Google.Api.Gax: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
我已经生成的JSON文件的上传到我的AF服务帐户的关键。通常情况下,我想,我可以访问我的BigQuery表格通过知道像这样的项目,并dadaset的ID在我的C#代码:
string projectId = "...";
string datasetId = "...";
var client = BigQueryClient.Create(projectId);
List<BigQueryTable> tables = client.ListTables(datasetId).ToList();
包的目标是罚款和net46会工作。你能分享你的代码吗?你看到包恢复过程发生了吗?你是否偶然部署了project.lock.json文件? –
感谢您的评论。我不知道为什么,但几分钟后它没有发生这些错误。编译成功。但是我的功能仍然不起作用,因为缺少证书。我会更新我的问题。 – Mogry