Skip to content

Instantly share code, notes, and snippets.

@juri96
Created November 15, 2019 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juri96/39c711dcdf01333f710eefadaed50b10 to your computer and use it in GitHub Desktop.
Save juri96/39c711dcdf01333f710eefadaed50b10 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE MODEL `GCP_PROJECT_NAME.DATASET_NAME.pollution_kmeans` OPTIONS(model_type='kmeans') AS
WITH dataset AS (SELECT pm25,
pm10,
so2,
co,
o3,
temp,
press,
dewp,
rain,
timestamp,
station
FROM `GCP_PROJECT_NAME.DATASET_NAME.measurements`
WHERE pm25 IS NOT NULL
AND pm10 IS NOT NULL
AND so2 IS NOT NULL
AND co IS NOT NULL
AND o3 IS NOT NULL
AND temp IS NOT NULL
AND press IS NOT NULL
AND dewp IS NOT NULL
AND rain IS NOT NULL
AND timestamp IS NOT NULL
AND station IS NOT NULL
)
SELECT pm25,
pm10,
so2,
co,
o3,
temp,
press,
dewp,
rain
FROM dataset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment