Skip to content

Instantly share code, notes, and snippets.

@alasarr
Last active June 10, 2022 05:35
Show Gist options
  • Save alasarr/067102a9bdfbcc5e4678dcea58bf2077 to your computer and use it in GitHub Desktop.
Save alasarr/067102a9bdfbcc5e4678dcea58bf2077 to your computer and use it in GitHub Desktop.
Script to transform h3 tables to h3 int
----
-- BIGQUERY
---
-- Switzerland
create table carto-dev-data.public.derived_spatialfeatures_che_h3int_res8_v1_yearly_v2
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_che_h3res8_v1_yearly_v2;
create table carto-dev-data.public.derived_spatialfeatures_che_h3int_res10_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_che_h3res10_v1_yearly_v2_interpolated;
create table carto-dev-data.public.derived_spatialfeatures_che_h3int_res12_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_che_h3res12_v1_yearly_v2_interpolated;
-- Spain
create table carto-dev-data.public.derived_spatialfeatures_esp_h3int_res8_v1_yearly_v2
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_esp_h3res8_v1_yearly_v2;
create table carto-dev-data.public.derived_spatialfeatures_esp_h3int_res10_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_esp_h3res10_v1_yearly_v2_interpolated;
create table carto-dev-data.large.derived_spatialfeatures_esp_h3int_res12_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.large.derived_spatialfeatures_esp_h3res12_v1_yearly_v2_interpolated;
-- Ukranian
create table carto-dev-data.public.derived_spatialfeatures_ukr_h3int_res8_v1_yearly_v2
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_ukr_h3res8_v1_yearly_v2;
create table carto-dev-data.public.derived_spatialfeatures_ukr_h3int_res10_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_ukr_h3res10_v1_yearly_v2_interpolated;
create table carto-dev-data.large.derived_spatialfeatures_ukr_h3int_res12_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.large.derived_spatialfeatures_ukr_h3res12_v1_yearly_v2_interpolated;
-- USA
create table carto-dev-data.public.derived_spatialfeatures_usa_h3int_res8_v1_yearly_v2
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_usa_h3res8_v1_yearly_v2;
create table carto-dev-data.public.derived_spatialfeatures_usa_h3int_res10_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.public.derived_spatialfeatures_usa_h3res10_v1_yearly_v2_interpolated;
create table carto-dev-data.large.derived_spatialfeatures_usa_h3int_res12_v1_yearly_v2_interpolated
cluster by h3
as
select cast(concat('0x', h3) as int64) as h3, * except (h3)
from carto-dev-data.large.derived_spatialfeatures_usa_h3res12_v1_yearly_v2_interpolated;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment