Skip to content

Commit

Permalink
chore(repo): Clean up unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Dec 9, 2024
1 parent da93afb commit e9197a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 50 deletions.
14 changes: 1 addition & 13 deletions nowcasting_datamodel/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,7 @@ def create_all(self):

self.base.metadata.drop_all(self.engine)
self.base.metadata.create_all(self.engine)

# def make_partitions(self):
# """Make partitions tables (useful for testing)"""
# # get partitions
# self.partitions = get_partitions(2019, 1, 2022, 7)

# # make partitions
# for partition in self.partitions:
# if not self.engine.dialect.has_table(
# connection=self.engine.connect(), table_name=partition.__table__.name
# ):
# partition.__table__.create(bind=self.engine)


def drop_all(self):
"""Drop all partitions and tables"""
# drop partitions
Expand Down
4 changes: 2 additions & 2 deletions nowcasting_datamodel/migrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
When we change the datamodel of the PV or Forecast database we will need to run a database migration

## 1. old local database
start local database of database before data model changes. This can be done by setting `DB_URL` and `DB_URL_PV` and running
by running ```python nowcasting_datamodel/migrations/app.py --make-migrations```
Start local database of database before data model changes. This can be done by setting `DB_URL` and running
```python nowcasting_datamodel/migrations/app.py --make-migrations```

## 2. run migrations scripts
by running ```python nowcasting_datamodel/migrations/app.py --run-migrations```
Expand Down
35 changes: 0 additions & 35 deletions nowcasting_datamodel/models/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,41 +153,6 @@ class ForecastValueSQL(
forecast = relationship("ForecastSQL", back_populates="forecast_values")


# def get_partitions(start_year: int, start_month: int, end_year: int, end_month: int):
# """Make partitions.
#
# This is used in the connections object for testing.
# TODO: Thoroughly distinguish between this and make_parititons
# """
# partitions = []
# for year in range(start_year, end_year + 1):
# if year != start_year:
# start_month = 1
# if year == end_year:
# end_month_loop = end_month
# else:
# end_month_loop = 13
#
# for month in range(start_month, end_month_loop):
# if month == 12:
# year_end = year + 1
# month_end = 1
# else:
# year_end = year
# month_end = month + 1
#
# if month < 10:
# month = f"0{month}"
# if month_end < 10:
# month_end = f"0{month_end}"
#
# partitions.append(
# ForecastValueSQL.create_partition(f"{year}_{month}", f"{year_end}_{month_end}")
# )
#
# return partitions


def create_forecastvalueyearmonth_class(year, month):
"""Dynamically create a ForecastValueYearMonthClass dynamically for input year and month"""

Expand Down

0 comments on commit e9197a6

Please sign in to comment.