Spaces:
Sleeping
Sleeping
added a check for duckdb file
Browse files- eda/load_clean.py +4 -0
eda/load_clean.py
CHANGED
|
@@ -9,6 +9,7 @@ Responsibilities:
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
from datetime import timedelta
|
|
|
|
| 12 |
|
| 13 |
import polars as pl
|
| 14 |
|
|
@@ -61,6 +62,9 @@ def load_raw() -> tuple[pl.DataFrame, pl.DataFrame]:
|
|
| 61 |
try:
|
| 62 |
import duckdb
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
if DUCKDB_FILE.exists():
|
| 65 |
print(f"Loading raw data from DuckDB: {DUCKDB_FILE}")
|
| 66 |
conn = duckdb.connect(str(DUCKDB_FILE))
|
|
|
|
| 9 |
"""
|
| 10 |
|
| 11 |
from datetime import timedelta
|
| 12 |
+
from pathlib import Path
|
| 13 |
|
| 14 |
import polars as pl
|
| 15 |
|
|
|
|
| 62 |
try:
|
| 63 |
import duckdb
|
| 64 |
|
| 65 |
+
if not Path(DUCKDB_FILE).exists():
|
| 66 |
+
print("DuckDB file not found, skipping DuckDB load.")
|
| 67 |
+
raise FileNotFoundError("DuckDB file not found.")
|
| 68 |
if DUCKDB_FILE.exists():
|
| 69 |
print(f"Loading raw data from DuckDB: {DUCKDB_FILE}")
|
| 70 |
conn = duckdb.connect(str(DUCKDB_FILE))
|