File tree Expand file tree Collapse file tree 4 files changed +84
-0
lines changed
Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Original file line number Diff line number Diff line change 1+ {{
2+ config(
3+ materialized= ' table' ,
4+ post_hook= ' alter table {{ this }} add search optimization on geo(point_features);'
5+ )
6+ }}
7+
8+ select
9+
10+ -- https://docs.snowflake.com/en/sql-reference/functions/st_collect
11+ st_collect(point ) as point_features
12+ from {{ ref(' stg_bikes_station_info' ) }}
Original file line number Diff line number Diff line change 1+ version : 2
2+
3+
4+ sources :
5+ - name : bikes
6+ database : chicago_divvy_bike_station_status
7+ schema : public
8+ tables :
9+ - name : station_info_flatten
10+ columns :
11+ - name : station_id
12+ tests :
13+ - not_null
14+ - unique
15+ - name : lat
16+ tests :
17+ - dbt_utils.expression_is_true :
18+ expression : " lat between -90 and 90"
19+ - dbt_utils.expression_is_true :
20+ expression : " lon between -180 and 180"
21+ - name : station_status_flatten_full
Original file line number Diff line number Diff line change 1+ with source as (
2+ select * from {{ source(' bikes' , ' station_info_flatten' ) }}
3+ ),
4+
5+ recast as (
6+ select
7+ short_name::varchar as short_name,
8+ station_type::varchar as station_type,
9+ name::varchar as name,
10+ electric_bike_surcharge_waiver,
11+ external_id::varchar as external_id,
12+ legacy_id::int as legacy_id,
13+ capacity,
14+ has_kiosk,
15+ station_id::varchar as station_id,
16+ region_id::int as region_id,
17+ eightd_station_services,
18+ lat as latitude,
19+ lon as longitude,
20+
21+ -- https://docs.snowflake.com/en/sql-reference/functions/st_makepoint
22+ st_makepoint(lon, lat) as point
23+ from source
24+ )
25+
26+ select * from recast
Original file line number Diff line number Diff line change 1+ with source as (
2+ select * from {{ source(' bikes' , ' station_status_flatten_full' ) }}
3+ ),
4+
5+ recast as (
6+ select
7+ station_id::varchar as station_id,
8+ station_status::varchar as station_status,
9+ num_ebikes_available,
10+ num_bikes_available,
11+ num_docks_available,
12+ num_docks_disabled,
13+ num_bikes_disabled,
14+ is_installed,
15+ num_ebikes_available_bool as is_ebikes_available,
16+ is_renting,
17+ is_returning,
18+ eightd_has_available_keys,
19+ legacy_id::varchar as legacy_id,
20+ last_updated,
21+ last_reported
22+ from source
23+ )
24+
25+ select * from recast
You can’t perform that action at this time.
0 commit comments