Skip to content

Commit

Permalink
finish progress bar improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
BlinkyStitt committed Sep 4, 2024
1 parent 410dd99 commit 4d838bf
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions neynar_parquet_importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@
def sync_parquet_to_db(
db_engine,
table_name,
bytes_progress,
full_bytes_downloaded_id,
incremental_bytes_downloaded_id,
steps_progress,
full_steps_id,
incremental_steps_id,
full_bytes_downloaded_progress,
incremental_bytes_downloaded_progress,
full_steps_progress,
incremental_steps_progress,
):
"""Function that runs forever (barring exceptions) to download and import parquet files for a table.
Expand All @@ -67,13 +65,9 @@ def sync_parquet_to_db(

if full_filename is None:
# if no full export, download the latest one
full_filename = download_latest_full(
table_name, bytes_progress, full_bytes_downloaded_id
)
full_filename = download_latest_full(table_name, full_bytes_downloaded_progress)

import_parquet(
db_engine, table_name, full_filename, "full", steps_progress, full_steps_id
)
import_parquet(db_engine, table_name, full_filename, "full", full_steps_progress)

# TODO: check the database to see if we've already imported incrementals
# TODO: when writing more advanced logic for skipping handled files, be sure not to miss any! upgrades or outages might cause a file to be missing for a couple hours
Expand All @@ -100,8 +94,7 @@ def sync_parquet_to_db(
table_name,
next_start_timestamp,
INCREMENTAL_SECONDS,
bytes_progress,
incremental_bytes_downloaded_id,
incremental_bytes_downloaded_progress,
)

if incremental_filename is None:
Expand All @@ -121,8 +114,7 @@ def sync_parquet_to_db(
table_name,
incremental_filename,
"incremental",
steps_progress,
incremental_steps_id,
incremental_steps_progress,
)


Expand Down

0 comments on commit 4d838bf

Please sign in to comment.