Skip to content

Commit

Permalink
Add 0 default to max and min id (#246)
Browse files Browse the repository at this point in the history
The script crashes if the DB is empty, as max_id and min_id is None and the loop can't iterate on them.
  • Loading branch information
benceluzsinszky authored Oct 6, 2024
1 parent 8f840e0 commit 78bc683
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/mysql_to_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def main(starting_index):

max_id = session.query(func.max(Article.id)).first()[0]
min_id = session.query(func.min(Article.id)).first()[0]

if max_id is None:
max_id = 0
if min_id is None:
min_id = 0

print(f"starting import at: {starting_index}")
print(f"max id in db: {max_id}")

Expand Down

0 comments on commit 78bc683

Please sign in to comment.