1- Python Client for Google BigQuery
2- =================================
1+ IPython Magics for BigQuery
2+ ===========================
33
44|GA | |pypi | |versions |
55
@@ -70,7 +70,7 @@ Mac/Linux
7070 pip install virtualenv
7171 virtualenv <your-env>
7272 source <your-env>/bin/activate
73- <your-env>/bin/pip install google-cloud- bigquery
73+ <your-env>/bin/pip install bigquery-magics
7474
7575
7676 Windows
@@ -81,61 +81,4 @@ Windows
8181 pip install virtualenv
8282 virtualenv <your-env>
8383 <your-env>\Scripts\activate
84- <your-env>\Scripts\pip.exe install google-cloud-bigquery
85-
86- Example Usage
87- -------------
88-
89- Perform a query
90- ~~~~~~~~~~~~~~~
91-
92- .. code :: python
93-
94- from google.cloud import bigquery
95-
96- client = bigquery.Client()
97-
98- # Perform a query.
99- QUERY = (
100- ' SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` '
101- ' WHERE state = "TX" '
102- ' LIMIT 100' )
103- query_job = client.query(QUERY ) # API request
104- rows = query_job.result() # Waits for query to finish
105-
106- for row in rows:
107- print (row.name)
108-
109- Instrumenting With OpenTelemetry
110- --------------------------------
111-
112- This application uses `OpenTelemetry `_ to output tracing data from
113- API calls to BigQuery. To enable OpenTelemetry tracing in
114- the BigQuery client the following PyPI packages need to be installed:
115-
116- .. _OpenTelemetry : https://opentelemetry.io
117-
118- .. code-block :: console
119-
120- pip install google-cloud-bigquery[opentelemetry] opentelemetry-exporter-gcp-trace
121-
122- After installation, OpenTelemetry can be used in the BigQuery
123- client and in BigQuery jobs. First, however, an exporter must be
124- specified for where the trace data will be outputted to. An
125- example of this can be found here:
126-
127- .. code-block :: python
128-
129- from opentelemetry import trace
130- from opentelemetry.sdk.trace import TracerProvider
131- from opentelemetry.sdk.trace.export import BatchSpanProcessor
132- from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
133- tracer_provider = TracerProvider()
134- tracer_provider = BatchSpanProcessor(CloudTraceSpanExporter())
135- trace.set_tracer_provider(TracerProvider())
136-
137- In this example all tracing data will be published to the Google
138- `Cloud Trace `_ console. For more information on OpenTelemetry, please consult the `OpenTelemetry documentation `_.
139-
140- .. _OpenTelemetry documentation : https://opentelemetry-python.readthedocs.io
141- .. _Cloud Trace : https://cloud.google.com/trace
84+ <your-env>\Scripts\pip.exe install bigquery-magics
0 commit comments