It seems that calling load_table_from_dataframe() and awaiting the result of the load job using the .result() method doesn't always guarantee an in time creation, or readiness of the table, when using it in subsequent queries. In rare occasions, I get a google.api_core.exceptions.NotFound error when trying to access the newly created table directly after awaiting the load job result.
Environment details
OS: Ubuntu 22.04.2 LTS
Python version: 3.10.12
pip version: 23.3.2
google-cloud-bigquery version: 3.17.2
Steps to reproduce
Create a pandas DataFrame.
Call load_table_from_dataframe using a write_disposition = WRITE_TRUNCATE and create_disposition = CREATE_IF_NEEDED in the bigquery.LoadJobConfig(), and awaiting the result using the .result() method.
Directly query the newly created table afterwards.
Location: EU
Job ID: <id>
google.api_core.exceptions.NotFound: 404 Not found: Table <table_id>; reason: notFound, message: Not found: <table_id>
Note that this code snippet does not necessarily result in the NotFound error, only in some rare cases do I experience this issue, but there seems to be some inconsistency nonetheless.
It seems that calling load_table_from_dataframe() and awaiting the result of the load job using the .result() method doesn't always guarantee an in time creation, or readiness of the table, when using it in subsequent queries. In rare occasions, I get a google.api_core.exceptions.NotFound error when trying to access the newly created table directly after awaiting the load job result.
Environment details
Steps to reproduce
Code example
Stack trace
Note that this code snippet does not necessarily result in the NotFound error, only in some rare cases do I experience this issue, but there seems to be some inconsistency nonetheless.