Class GoogleBigQueryDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.dll
Provides a data provider implementation for Google BigQuery.
public sealed class GoogleBigQueryDataProvider : IDataProvider
- Inheritance
-
GoogleBigQueryDataProvider
- Implements
- Inherited Members
Examples
The following example demonstrates how to use the GoogleBigQueryDataProvider to export a report to PDF:
// Initialize the provider with OAuth credentials and project ID
GoogleBigQueryDataProvider provider = new GoogleBigQueryDataProvider(
"your-gcp-project-id",
"your_refresh_token",
"your_client_id.apps.googleusercontent.com",
"your_client_secret");
// Optional: Configure row limit per request
provider.RowsPerDataRequest = 10000;
// Add a query for customer analysis
provider.AddQuery(
"CustomerAnalysis",
@"SELECT
customer_id,
customer_name,
total_purchases,
total_revenue
FROM `project.dataset.customers`
WHERE total_revenue > 1000
ORDER BY total_revenue DESC
LIMIT 1000");
// Add a query for sales by region
provider.AddQuery(
"SalesByRegion",
@"SELECT
region,
COUNT(*) as order_count,
SUM(amount) as total_sales,
AVG(amount) as avg_order_value
FROM `project.dataset.orders`
WHERE order_date BETWEEN '2024-01-01' AND '2024-12-31'
GROUP BY region
ORDER BY total_sales DESC");
// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;
// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
// Export the report to PDF.
listLabel.Export(exportConfiguration);
Remarks
The GoogleBigQueryDataProvider class implements IDataProvider to enable access to Google BigQuery, Google Cloud's fully-managed, serverless data warehouse for analytics at scale. The provider uses OAuth 2.0 authentication with refresh tokens and executes standard SQL queries against BigQuery datasets. Each SQL query added to the provider becomes a table, allowing users to define custom data views from their BigQuery data. The provider automatically handles authentication token refresh and supports configurable row limits per request to manage costs and performance. Job IDs are tracked internally for query execution monitoring. This provider is ideal for creating reports from large-scale analytics data stored in BigQuery, enabling integration with other data sources through List & Label's multi-provider capabilities.
Constructors
GoogleBigQueryDataProvider(string, string, string, string)
Initializes a new instance of the GoogleBigQueryDataProvider class.
public GoogleBigQueryDataProvider(string projectId, string refreshToken, string clientId, string clientSecret)
Parameters
projectIdstringThe Google Cloud project identifier.
refreshTokenstringThe refresh token for authentication.
clientIdstringThe client identifier.
clientSecretstringThe client secret.
Properties
ClientId
Gets the client identifier.
public string ClientId { get; }
Property Value
ProjectId
Gets the Google Cloud project identifier.
public string ProjectId { get; }
Property Value
RefreshToken
Gets the refresh token used for authentication.
public string RefreshToken { get; }
Property Value
RowsPerDataRequest
Gets or sets the maximum number of rows per data request.
public int RowsPerDataRequest { get; set; }
Property Value
Methods
AddQuery(string, string)
Adds a new query to the provider.
public void AddQuery(string tableName, string query)
Parameters
tableNamestringThe name of the table to be created from the query results.
querystringThe SQL query to execute in BigQuery.
Exceptions
- ListLabelException
Thrown if the table name or query is empty.