Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
datejada committed Feb 4, 2025
1 parent 5c1f9ac commit df233a7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/variables/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function _create_variables_tables(connection)
connection,
"CREATE OR REPLACE TEMP SEQUENCE id START 1;
CREATE OR REPLACE TABLE var_storage_level_rep_period AS
WITH filtered_data AS (
WITH filtered_assets AS (
SELECT
t_low.asset,
t_low.year,
Expand All @@ -109,20 +109,16 @@ function _create_variables_tables(connection)
)
SELECT
nextval('id') AS index,
asset,
year,
rep_period,
time_block_start,
time_block_end
FROM filtered_data
filtered_assets.*
FROM filtered_assets
",
)

DuckDB.query(
connection,
"CREATE OR REPLACE TEMP SEQUENCE id START 1;
CREATE OR REPLACE TABLE var_storage_level_over_clustered_year AS
WITH filtered_data AS (
WITH filtered_assets AS (
SELECT
attr.asset,
attr.year,
Expand All @@ -133,18 +129,16 @@ function _create_variables_tables(connection)
ON attr.asset = asset.asset
WHERE
asset.type = 'storage'
AND asset.is_seasonal = true
ORDER BY
attr.asset,
attr.year,
attr.period_block_start
)
SELECT
nextval('id') AS index,
asset,
year,
period_block_start,
period_block_end
FROM filtered_data
filtered_assets.*
FROM filtered_assets
",
)

Expand Down

0 comments on commit df233a7

Please sign in to comment.