Skip to content

Commit

Permalink
ruff-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LariDG committed Jan 20, 2025
1 parent 25fc8be commit a6b5d31
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/api/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

import click
import dask
import numpy as np
import pandas as pd
import pyarrow.parquet as pq
from sqlalchemy import Table, MetaData, create_engine, text, inspect
from sqlalchemy import MetaData, create_engine, text, inspect
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy_utils.functions import (
create_database,
Expand Down Expand Up @@ -86,10 +85,10 @@ def __init__(self, uri: str, db_name: str):
def create_database(self):
print(database_exists(self.uri))
if not database_exists(self.uri):
logging.info(f"Database does not exist. Creating.")
logging.info("Database does not exist. Creating.")
create_database(self.uri)
else:
logging.info(f"Database exists. Skipping creation.")
logging.info("Database exists. Skipping creation.")

self.metadata_obj, self.engine = connect(self.uri)

Expand Down Expand Up @@ -129,7 +128,7 @@ def create_or_upsert_table(self, table_name: str, df: pd.DataFrame):
self.metadata_obj.reflect(bind=self.engine)

if table_name not in self.metadata_obj.tables:
logging.info(f"Creating table {table_name} from scratch.")
logging.info("Creating table {table_name} from scratch.")
df.to_sql(table_name, self.engine, if_exists="append")

table = self.metadata_obj.tables[table_name]
Expand Down Expand Up @@ -216,7 +215,7 @@ def create_shots(self, data_path: Path):
self.create_or_upsert_table("shots", shot_metadata)

def create_signals(self, data_path: Path):
logging.info(f"Loading signals from {data_path}")
logging.info("Loading signals from {data_path}")
file_name = data_path / "signals.parquet"

parquet_file = pq.ParquetFile(file_name)
Expand Down

0 comments on commit a6b5d31

Please sign in to comment.