1
votes

I have query pertaining to the google big query tables. We are currently looking to query the big query table based on the file uploaded on the day into the cloud storage.

Meaning:

I have to load the data into big query table based on every day's data into cloud storage.

When i query:

select * from BQT where load_date =<TODAY's DATE>

Can we achieve this without adding the date field into the file?

1

1 Answers

0
votes

If you just don't want to add a date column, Append current date suffix to your table name like BQT_20200112 when the GCS file is uploaded.

Then you can query specific datetime table by _TABLE_SUFFIX syntax.

Below is example query using _TABLE_SUFFIX

SELECT
  field1,
  field2,
  field3
FROM
  `your_dataset.BQT_*`
WHERE
  _TABLE_SUFFIX = '20200112'

As you see, You don't need to add additional field like load_date when you query the tables using date suffix and wildcard symbol.