Skip to content

Commit

Permalink
Add model to database if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
RyEggGit committed Jan 10, 2024
1 parent 85e24e2 commit 5bc8849
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/scraper/run_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def add_to_database(
logger.info(f"{table} {uid} already in cache")
return

# add the model to the database
# Check if the model already exists in the database
model_exists: bool
if table == "officer":
model_exists = officer_exists(
Expand All @@ -41,7 +43,7 @@ def add_to_database(
)
else:
raise ValueError(f"Invalid table {table}")
if model_exists:
if model_exists: # type: ignore
logger.info(f"{table} {uid} already in database")
return

Expand Down

0 comments on commit 5bc8849

Please sign in to comment.