- Notifications
You must be signed in to change notification settings - Fork321
License
googleapis/python-bigquery
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Querying massive datasets can be time consuming and expensive without theright hardware and infrastructure. GoogleBigQuery solves this problem byenabling super-fast, SQL queries against append-mostly tables, using theprocessing power of Google's infrastructure.
In order to use this library, you first need to go through the following steps:
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Google Cloud BigQuery API.
- Setup Authentication.
Install this library in avirtualenv using pip.virtualenv is a tool tocreate isolated Python environments. The basic problem it addresses is one ofdependencies and versions, and indirectly permissions.
Withvirtualenv, it's possible to install this library without needing systeminstall permissions, and without clashing with the installed systemdependencies.
Python >= 3.7
Python == 2.7, Python == 3.5, Python == 3.6.
The last version of this library compatible with Python 2.7 and 3.5 isgoogle-cloud-bigquery==1.28.0.
pip install virtualenvvirtualenv <your-env>source <your-env>/bin/activate<your-env>/bin/pip install google-cloud-bigquery
pip install virtualenvvirtualenv <your-env><your-env>\Scripts\activate<your-env>\Scripts\pip.exe install google-cloud-bigquery
fromgoogle.cloudimportbigqueryclient=bigquery.Client()# Perform a query.QUERY= ('SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` ''WHERE state = "TX" ''LIMIT 100')query_job=client.query(QUERY)# API requestrows=query_job.result()# Waits for query to finishforrowinrows:print(row.name)
This application usesOpenTelemetry to output tracing data fromAPI calls to BigQuery. To enable OpenTelemetry tracing inthe BigQuery client the following PyPI packages need to be installed:
pip install google-cloud-bigquery[opentelemetry] opentelemetry-exporter-google-cloudAfter installation, OpenTelemetry can be used in the BigQueryclient and in BigQuery jobs. First, however, an exporter must bespecified for where the trace data will be outputted to. Anexample of this can be found here:
fromopentelemetryimporttracefromopentelemetry.sdk.traceimportTracerProviderfromopentelemetry.sdk.trace.exportimportBatchExportSpanProcessorfromopentelemetry.exporter.cloud_traceimportCloudTraceSpanExportertrace.set_tracer_provider(TracerProvider())trace.get_tracer_provider().add_span_processor(BatchExportSpanProcessor(CloudTraceSpanExporter()))
In this example all tracing data will be published to the GoogleCloud Trace console. For more information on OpenTelemetry, please consult theOpenTelemetry documentation.
About
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.