Skip to content

Commit 1e16f48

Browse files
committed
fix try-except and stack trace anbd use env variable BIOMARK_DUCKDB_PATH
1 parent 4e191f5 commit 1e16f48

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/datasync/pit_registering_salmon.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
BIOMARK_REGION = env("BIOMARK_REGION", default="us-east-1")
3030
BIOMARK_ACCESS_KEY = env("BIOMARK_ACCESS_KEY", default="")
3131
BIOMARK_SECRET_KEY = env("BIOMARK_SECRET_KEY", default="")
32-
BIOMARK_DUCKDB_PATH = env("BIOMARK_DUCKDB_PATH", default="")
32+
BIOMARK_DUCKDB_PATH = env(
33+
"BIOMARK_DUCKDB_PATH", default="biomark_pit_registering_salmon_v1.duckdb"
34+
)
3335

3436
app = typer.Typer()
3537

@@ -259,7 +261,7 @@ def run(
259261
log.info("Processing single location", location=place)
260262

261263
pipeline = dlt.pipeline(
262-
pipeline_name="biomark_pit_registering_salmon_v1",
264+
pipeline_name=BIOMARK_DUCKDB_PATH.replace(".duckdb", ""),
263265
destination="duckdb",
264266
dataset_name="main",
265267
progress="log",
@@ -334,13 +336,15 @@ def check_table_has_data(db_path: str, table_name: str) -> bool:
334336

335337
log.info(f"Table {table_name} has {row_count} rows")
336338
return row_count > 0
337-
339+
except Exception as e:
340+
raise Exception(f"Error checking table {table_name}") from e
338341
finally:
339342
conn.close()
340343

341344
except Exception as e:
342-
log.error(f"Error checking table {table_name}: {e}")
343-
return False
345+
log.error(f"Error with database: {e}")
346+
347+
return False
344348

345349

346350
@app.command()

0 commit comments

Comments
 (0)