Count the total number of entries in the v-safe checkin file

This is the marimo script

parquet_path = Path(__file__).resolve().parent / "parquet" / "checkins.parquet"

if not parquet_path.is_file():
    result = mo.md(f"Parquet file not found: `{parquet_path}`")
else:
    path_sql = parquet_path.as_posix().replace("'", "''")
    con = duckdb.connect()
    row_count = con.sql(
        f"SELECT COUNT(*)::BIGINT FROM read_parquet('{path_sql}')"
    ).fetchone()[0]
    result = mo.md(
        f"""
        # Check-ins row count


        **{row_count:,}** rows
        """
    )
result

This is the result

Leave a Reply