Ido Barash
Ido Barash

Reputation: 5122

Google Bigquery table decorators

I need to add decorators that will represent from 6 days ago till now.

how should I do it?

lets say the date is realative 604800000 millis from now and it's absolute is 1427061600000

Is there a difference by using relative or absolute times?

Thanks

Upvotes: 0

Views: 552

Answers (2)

YABADABADOU
YABADABADOU

Reputation: 1328

@-518400000--1

Will give you data for the last 6 days (or last 144 hours).

Upvotes: 3

Patrice
Patrice

Reputation: 4692

I think all you need is to read this.

Basically, you have the choice of @time, which is time since Epoch (your @1427061600000). You can also express it as a negative number, which the system will interpret as NOW - time (your @-604800000). These both work, but they don't give the result you want. Instead of returning all that was added in that time range, it will return a snapshot of your table from 6 days ago....

Although you COULD use that snapshot, eliminate all duplicates between that snapshot and your current table, and then take THOSE results as what was added during your 6 days, you're better off with :

Using time ranges directly, which you cover with your 3rd and 4th lines. I don't know if the order makes a difference, but I've always used @time1-time2 with time1<time2 (in your case, @1427061600000 - now in millis).

Upvotes: 1

Related Questions