Skip to content

Instantly share code, notes, and snippets.

@securetorobert
Created May 20, 2019 02:15
Show Gist options
  • Save securetorobert/1ad26b7b717b7f36ddcef5daf22e8c2a to your computer and use it in GitHub Desktop.
Save securetorobert/1ad26b7b717b7f36ddcef5daf22e8c2a to your computer and use it in GitHub Desktop.
Get prediction with BQML
#standardSQL
SELECT
*
FROM
ML.PREDICT(MODEL `bqml_tutorial.sample_model`, (
SELECT
IFNULL(device.operatingSystem, "") AS os,
device.isMobile AS is_mobile,
IFNULL(totals.pageviews, 0) AS pageviews,
IFNULL(geoNetwork.country, "") AS country
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE
_TABLE_SUFFIX BETWEEN '20170701' AND '20170801'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment