Skip to content

Commit

Permalink
fix/ cpf_summary test error
Browse files Browse the repository at this point in the history
  • Loading branch information
khalsz committed Dec 13, 2024
1 parent a62c35d commit dbf6ff5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/api/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def create_cpf_summary(self, data_path: Path):
paths = data_path.glob("cpf/*_cpf_columns.parquet")
for path in paths:
df = pd.read_parquet(path)
print(df, "duty")
df.to_sql("cpf_summary", self.uri, if_exists="replace")

def create_scenarios(self, data_path: Path):
Expand Down Expand Up @@ -243,7 +244,7 @@ def create_db_and_tables(data_path):

# populate the database tables
logging.info("Create CPF summary")
client.create_cpf_summary(data_path / "cpf")
client.create_cpf_summary(data_path)

logging.info("Create Scenarios")
client.create_scenarios(data_path)
Expand Down
2 changes: 1 addition & 1 deletion src/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class SourceModel(SQLModel, table=True):


class CPFSummaryModel(SQLModel, table=True):
__tablename__ = "mcs_selectummary"
__tablename__ = "cpf_summary"

index: int = Field(primary_key=True, nullable=False)
name: str = Field(sa_column=Column(Text), description="Name of the CPF variable.")
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_get_cpf_summary(client, override_get_db):
response = client.get("json/cpf_summary")
data = response.json()
assert response.status_code == 200
assert len(data["items"]) == 0
assert len(data["items"]) == 50


def test_get_scenarios(client, override_get_db):
Expand Down

0 comments on commit dbf6ff5

Please sign in to comment.