google.cloud.forseti.common.gcp_api.bigquery module

Wrapper for the BigQuery API client.

class BigQueryClient(global_configs, **kwargs)[source]

Bases: object

BigQuery Client manager.

get_bigquery_projectids()[source]

Request and page through bigquery projectids.

Returns:A list of project_ids enabled for bigquery.

If there are no project_ids enabled for bigquery an empty list will be returned.

Return type:list

An example return value:

[‘project-id’,
‘project-id’, ‘…’]
get_dataset_access(project_id, dataset_id)[source]

Return the access portion of the dataset resource object.

Parameters:
  • project_id (str) – String representing the project id.
  • dataset_id (str) – String representing the dataset id.
Returns:

A list of access lists for a given project_id and dataset_id.

Return type:

list

An example return value:

[
{‘role’: ‘WRITER’, ‘specialGroup’: ‘projectWriters’}, {‘role’: ‘OWNER’, ‘specialGroup’: ‘projectOwners’}, {‘role’: ‘OWNER’, ‘userByEmail’: ‘user@domain.com’}, {‘role’: ‘READER’, ‘specialGroup’: ‘projectReaders’}

]

get_datasets_for_projectid(project_id)[source]

Return BigQuery datasets stored in the requested project_id.

Parameters:project_id (str) – String representing the project id.
Returns:A list of datasetReference objects for a given project_id
Return type:list

An example return value:

[{‘datasetId’: ‘dataset-id’,
‘projectId’: ‘project-id’},

{…}]

class BigQueryRepositoryClient(quota_max_calls=None, quota_period=100.0, use_rate_limiter=True)[source]

Bases: google.cloud.forseti.common.gcp_api._base_repository.BaseRepositoryClient

Big Query API Respository.

datasets

Returns a _BigQueryDatasetsRepository instance.

projects

Returns a _BigQueryProjectsRepository instance.

class _BigQueryDatasetsRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.GetQueryMixin, google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Big Query Datasets repository.

class _BigQueryProjectsRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Big Query Projects repository.