Created
June 11, 2020 08:04
-
-
Save velotiotech/fbfaf3e37744e5598c64e41f1bf39f2a to your computer and use it in GitHub Desktop.
BigQuery 101: All the Basics You Need to Know - Code for Velotio Blog Part - 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE MODEL `velotio_tutorial.sample_model` | |
OPTIONS(model_type='logistic_reg') AS | |
SELECT | |
IF(totals.transactions IS NULL, 0, 1) AS label, | |
IFNULL(device.operatingSystem, "") AS os, | |
device.isMobile AS is_mobile, | |
IFNULL(geoNetwork.country, "") AS country, | |
IFNULL(totals.pageviews, 0) AS pageviews | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_*` | |
WHERE | |
_TABLE_SUFFIX BETWEEN '20190401' AND '20180630' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment