OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Using Google.Cloud.BigQuery.V2 API in Azure Functions

  • Thread starter Thread starter Mogry
  • Start date Start date
M

Mogry

Guest
Is there a way to use Google.Cloud.BigQuery.V2 (1.0.0-beta10) API in Azure Functions?

I like to use this API and my C# code in Azure Functions but get this error:

Code:
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.

In my project.json I have the following code:

Code:
{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Google.Cloud.BigQuery.V2": "1.0.0-beta10"
      }
    }
   }
}

I think the API is in .NET version 4.5 and Azure Functions needs 4.6. So it seems there is no way to use this API in AF? I tried it also with "net45" but get the same errors.

UPDATE: This API is working on AF (see also comment below). Compilation succeeded. But my function is still not working because of missing credentials. In my Visual Studio the code is running and working like it should but in AF I got the following error:

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.

I already generated a service account key as json file an uploaded to my AF. Normally, I think, I get access to my tables on BigQuery through knowing the project and dadaset IDs like this in my C# code:

Code:
string projectId = "...";
string datasetId = "...";

var client = BigQueryClient.Create(projectId);

List<BigQueryTable> tables = client.ListTables(datasetId).ToList();
<p>Is there a way to use Google.Cloud.BigQuery.V2 (1.0.0-beta10) API in Azure Functions?</p>
<p>I like to use this API and my C# code in Azure Functions but get this error:</p>
<pre><code>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.
</code></pre>
<p>In my project.json I have the following code:</p>
<pre><code>{
"frameworks": {
"net46":{
"dependencies": {
"Google.Cloud.BigQuery.V2": "1.0.0-beta10"
}
}
}
}
</code></pre>
<p>I think the API is in .NET version 4.5 and Azure Functions needs 4.6. So it seems there is no way to use this API in AF?
I tried it also with "net45" but get the same errors.</p>
<p>UPDATE: This API is working on AF (see also comment below). Compilation succeeded. But my function is still not working because of missing credentials. In my Visual Studio the code is running and working like it should but in AF I got the following error:</p>
<blockquote>
<p>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 <a href="https://developers.google.com/accounts/docs/application-default-credentials" rel="nofollow noreferrer">https://developers.google.com/accounts/docs/application-default-credentials</a> for more information.</p>
</blockquote>
<p>I already generated a service account key as json file an uploaded to my AF. Normally, I think, I get access to my tables on BigQuery through knowing the project and dadaset IDs like this in my C# code:</p>
<pre><code>string projectId = "...";
string datasetId = "...";

var client = BigQueryClient.Create(projectId);

List<BigQueryTable> tables = client.ListTables(datasetId).ToList();
</code></pre>
Continue reading...
 

Latest posts

Online statistics

Members online
0
Guests online
2
Total visitors
2
Ads by Eonads
Top