-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: document airbyte omie historical price hour change from fr to …
…incremental (et/somenergia-jardiner!27) * chore: document airbyte omie historical price hour change from fr to incremental
- Loading branch information
Showing
2 changed files
with
17 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 14 additions & 29 deletions
43
...odels/jardiner/raw/omie/raw_plantlake_omie_historical_price__with_row_number_per_date.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,16 @@ | ||
{{ config( | ||
materialized = 'view' | ||
) }} | ||
{# | ||
todo airbyte IS currently doing A full - refresh which DROP - cascades, | ||
we materialize this model TO avoid checking if we can incremental - sync instead but it would NOT happen if we don 'T normalize the data, which we don' t actually need TO DO https:// discuss.airbyte.io / t / remove - related - VIEWS - IN - full - refresh - overwrite - MODE / 747 #} | ||
WITH recent AS ( | ||
{{ config(materialized="view") }} | ||
|
||
SELECT | ||
"date", | ||
create_time, | ||
price, | ||
ROW_NUMBER() OVER ( | ||
PARTITION BY "date" | ||
ORDER BY | ||
create_time DESC | ||
) AS rc | ||
FROM | ||
{{ source( | ||
'plantlake', | ||
'omie_historical_price_hour' | ||
) }} | ||
) | ||
with | ||
recent as ( | ||
|
||
SELECT | ||
"date" AS start_hour, | ||
price | ||
FROM | ||
recent | ||
WHERE | ||
rc = 1 | ||
select | ||
"date", | ||
create_time, | ||
price, | ||
row_number() over (partition by "date" order by create_time desc) as rc | ||
from {{ source("plantlake", "omie_historical_price_hour") }} | ||
) | ||
|
||
select "date" as start_hour, price | ||
from recent | ||
where rc = 1 |