tandem
tandem

Reputation: 2238

How to access nested bigquery attributes?

I am trying to access a particular user property called "profileKey", and I want to get all events for the user with a certain profile key.

I tried doing the following

select * from this_table where user_properties.key.profileKey = 'someValue'

enter image description here

Upvotes: 2

Views: 486

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173151

Below is for BigQuery Standard SQL

#standardSQL
SELECT * 
FROM `project.dataset.this_table` t
WHERE EXISTS (
  SELECT 1 
  FROM t.user_properties 
  WHERE (key, value.string_value) = ('profileKey', 'someValue')
)

Upvotes: 4

Related Questions