googleapis/python-bigquery

get_table method, when given table name with a wildcard, returns instance having current timestamp in modified property.

Closed this issue · 2 comments

Environment details

  • OS type and version: Windows 11
  • Python version: 3.11.9
  • pip version: 24.0
  • google-cloud-bigquery: 3.16.0

Steps to reproduce

  1. get TableReference with a table name containing a wildcard
  2. call the get_table method to obtain the Table instance
  3. access to modified property

Code example

from google.cloud import bigquery

client = bigquery.Client(project="your-project")

table_ref = client.dataset("your_dataset").table("dummy_*")
table = client.get_table(table_ref)

print(table.modified)

Stack trace

No error happens.

It is reasonable that the get_table method only works when given an exact table name.
However, shouldn't it at least raise an error or warning instead of just returning the current timestamp?

Hi @tanukifk, thank you for raising the question. I think the code is working as intended here, when you query using a wildcard, the backend is essentially creating a temp table with all the tables that match the wildcard (probably with limited functionalities), so the table was indeed created right now. You can verify this by checking the number of rows of the wildcard table, it should be the sum of all matching tables. Also, if the wildcard doesn't match any table, an error is reported.

I will close the issue now, but if you have further questions, please leave a comment below, or open a new issue. :)

Thank you for answering my question. Since some of the applications I use do not know this wildcard behavior, I will tell them about it👍