Skip to content

Commit 9dc4534

Browse files
feat: DimCalendarMonth inserts
1 parent 8b525ca commit 9dc4534

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/awesome_date_dimension/_internal/tsql_templates/dim_fiscal_month_insert_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def dim_fiscal_month_insert_template(config: Config) -> str:
4545
GROUP BY {dd_cols.fiscal_current_month_start.name}, {dd_cols.fiscal_current_month_end.name}
4646
)
4747
48-
INSERT INTO dbo.DimFiscalMonth (
48+
INSERT INTO {dfm_conf.table_schema}.{dfm_conf.table_name} (
4949
{dfm_cols.month_start_key.name},
5050
{dfm_cols.month_end_key.name},
5151
{dfm_cols.month_start_date.name},

src/awesome_date_dimension/tsql.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
from pathlib import Path
44
from typing import Iterable
55

6+
from ._internal.tsql_templates.dim_calendar_month_insert_template import (
7+
dim_calendar_month_insert_template,
8+
)
69
from ._internal.tsql_templates.dim_date_insert_template import dim_date_insert_template
710
from ._internal.tsql_templates.dim_fiscal_month_insert_template import (
811
dim_fiscal_month_insert_template,
@@ -713,8 +716,13 @@ def _generate_dim_fiscal_month_build_scripts(
713716
def _generate_dim_calendar_month_build_scripts(
714717
self, file_no: int, base_path: Path
715718
) -> int:
716-
# raise NotImplementedError()
717-
pass
719+
scriptdef = dim_calendar_month_insert_template(self._config)
720+
file_path = base_path / TSQLGenerator._get_sql_filename(
721+
file_no, self._config.dim_calendar_month.table_name
722+
)
723+
TSQLGenerator._assert_filepath_available(file_path)
724+
file_path.write_text(scriptdef)
725+
return file_no + 1
718726

719727
def _generate_refresh_procs(self, folder_no: int) -> int:
720728
file_no = 0

0 commit comments

Comments
 (0)