Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save vaibhawvipul/6ec7cad2a137c69a03e5ad6062ffcaab to your computer and use it in GitHub Desktop.

Select an option

Save vaibhawvipul/6ec7cad2a137c69a03e5ad6062ffcaab to your computer and use it in GitHub Desktop.
BigQuery 101: All the Basics You Need to Know - Code for Velotio Blog Part - 2
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