**Author: Evgeny Semyonov** 

I'm using BiqQuery to analyze dataset and extracting features.
It's very easy to extract leak using it. BiqQuery use SQL that familiar for everyone.

How to upload files to BiqQuery:

1. Create bucket on Google Cloud Storage: https://console.cloud.google.com/storage/

2. Upload your files(page_views.csv, promoted_content.csv) to this bucket

3. On BiqQuery page create Project

4. Mouse over Project, use + to create tables

5. Location->Google Cloud Storage ; Destination Table-> YOUR_TABLE_NAME; Schema-> File schema; 
Header rows to skip->1 (to skip header)

*SQL Query*:

```sql
select v.document_id as document_id, GROUP_CONCAT(UNIQUE(v.uuid), ' ') as uuid from Outbrain.page_views as v 
JOIN Outbrain.promoted_content as p on v.document_id = p.document_id
group by document_id
```

Query takes 30 seconds(instead of 30 minutes by Python script https://www.kaggle.com/jiweiliu/outbrain-click-prediction/extract-leak-in-30-mins-with-small-memory )

To export table to csv:
1.Mouse over Table->Export table
2.Choose Compression->GZIP (it will be much faster! but it can be divided into multiple files); Google Cloud Storage URI: target file URI