Skip to content

TypeError(_NEED_TABLE_ARGUMENT) error using read_gbq #481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bizetremi opened this issue Feb 2, 2022 · 5 comments · Fixed by #483
Closed

TypeError(_NEED_TABLE_ARGUMENT) error using read_gbq #481

Bizetremi opened this issue Feb 2, 2022 · 5 comments · Fixed by #483
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery-pandas API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@Bizetremi
Copy link

Bizetremi commented Feb 2, 2022

Hello,

Version 0.17.0 introduced the error below when using read_gbq.

Example query used

UPDATE mydb.mytable set field1 = null
                             WHERE field1 = 'string' ;
UPDATE  mydb.mytable set field2 = null
                             WHERE field2 < 0

Environment details

  • OS type and version:
  • Python version: 3.7
  • pandas-gbq version: 0.17.0

Code example

pandas_gbq.read_gbq(
                sql,
                project_id=project_id,
                dialect='standard',
                progress_bar_type=None,
                use_bqstorage_api=True,
                max_results=0,)

Stack trace

File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pandas_gbq/gbq.py", line 870, in read_gbq dtypes=dtypes, File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pandas_gbq/gbq.py", line 499, in run_query query_reply.destination, max_results=max_results File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/bigquery/client.py", line 3780, in list_rows raise TypeError(_NEED_TABLE_ARGUMENT) TypeError: The table argument should be a table ID string, Table, or TableReference

Best,

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-pandas API. label Feb 2, 2022
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Feb 3, 2022
@meredithslota meredithslota added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Feb 3, 2022
@meredithslota
Copy link
Contributor

Actually, this might have been intentional — there were known breaking changes in 0.17.0 as per #477 — but I'm not totally sure.

@meredithslota
Copy link
Contributor

Copying out the stacktrace for my own readability:

File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pandas_gbq/gbq.py", line 870, in read_gbq dtypes=dtypes, File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pandas_gbq/gbq.py", line 499, in run_query query_reply.destination, max_results=max_results File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/bigquery/client.py", line 3780, in list_rows raise TypeError(_NEED_TABLE_ARGUMENT) TypeError: The table argument should be a table ID string, Table, or TableReference

@tswast
Copy link
Collaborator

tswast commented Feb 17, 2022

Hmmm... It appears that this is interpreting your query string as a table name. Perhaps we got the regex to detect whitespace incorrect?

Nevermind, it is in the run_query method.

File "/layers/google.python.pip/pip/lib/python3.7/site-packages/pandas_gbq/gbq.py", line 499, in run_query query_reply.destination, max_results=max_results File "/layers/google.python.pip/pip/lib/python3.7/site-

Somehow query_reply.destination is not being populated. Since this is a DML query, perhaps we need some special case for that -- since it might not have a destination table?

@tswast tswast self-assigned this Feb 22, 2022
@tswast
Copy link
Collaborator

tswast commented Feb 22, 2022

I can reproduce this error with a system test, though it seems the regression happened between 0.11.0 and 0.12.0, unless there was a brief fix for DML queries since then.

@tswast
Copy link
Collaborator

tswast commented Feb 22, 2022

Fix #483 has been mailed for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-pandas API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants