File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ # Troubleshooting steps
2+
3+ ## Enable logging of BQ Storage Read API session creation
4+
5+ It can be helpful to get the BQ Storage Read API session to allow the BigQuery
6+ backend team to debug cases of API instability. The logs that share the session
7+ creation are in a module-specific logger. To enable the logs, refer to the
8+ following code sample:
9+
10+ ``` python
11+ import logging
12+ import google.cloud.bigquery
13+
14+ # Configure the basic logging to show DEBUG level messages
15+ log_formatter = logging.Formatter(
16+ ' %(asctime)s - %(levelname)s - %(message)s '
17+ )
18+ handler = logging.StreamHandler()
19+ handler.setFormatter(log_formatter)
20+ default_logger = logging.getLogger()
21+ default_logger.setLevel(logging.DEBUG )
22+ default_logger.addHandler(handler)
23+ to_dataframe_logger = logging.getLogger(" google.cloud.bigquery._pandas_helpers" )
24+ to_dataframe_logger.setLevel(logging.DEBUG )
25+ to_dataframe_logger.addHandler(handler)
26+
27+ # Example code that touches the BQ Storage Read API.
28+ bqclient = google.cloud.bigquery.Client()
29+ results = bqclient.query_and_wait(" SELECT * FROM `bigquery-public-data.usa_names.usa_1910_2013`" )
30+ print (results.to_dataframe().head())
31+ ```
32+
33+ In particular, watch for the text "with BQ Storage API session" in the logs
34+ to get the streaming API session ID to share with your support person.
You can’t perform that action at this time.
0 commit comments