googleapis / googleapis/google-cloud-python

read_gbq: Runtime error when given table name for a view

Offen
#14,471 0 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @tswast Auf GitHub ansehen
api: bigquery type: feature request
Vorherrschende Sprache
Python
Sterne
5.4k
Forks
1.8k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
122

Beschreibung

When I try to use `read_gbq` where I pass in the name of a view, I get a runtime error caused by an unhandled 400 error from the API.

It looks like `read_gbq` tries to use the `tabledata.list` method which is not supported by the BigQuery API for views. I would expect `read_gbq` to be able to handle this query and use an appropriate API method.

As a work around, I am able to run the query `SELECT * FROM my_dataset.my_table` instead.

#### Environment details

- OS type and version: macOS 15.3.1 on M4 Pro
- Python version: 3.13.2
- `pandas-gbq` version: 0.28.0
- `google-cloud-bigquery` version: 3.30.0

#### Code example

```python
import pandas_gbq as pd_gbq

pd_gbq.read_gbq("my_dataset.my_table")
```

where `my_table` is a VIEW

#### Error

```
GenericGBQException: Reason: 400 GET : Cannot list a table of type VIEW.
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.