--- license: odc-by --- # DuckDB datasets for (dump, id) querying on FineWeb 2 This repo contains some DuckDB databases to check whether a given WARC UID exists in a FineWeb-2 dump. Usage example is given below, but note especially that if you are using URNs (likely, if you are working with CommonCrawl data), then you first have to extract the UID (the `id` column is of type `UUID` in the databases). ## Download All files: ```shell huggingface-cli download BramVanroy/fineweb-2-duckdbs --local-dir duckdbs/fineweb-2/ --include *.duckdb --repo-type dataset ``` One file: ```shell huggingface-cli download BramVanroy/fineweb-2-duckdbs fw2-deu_Latn.duckdb --local-dir duckdbs/fineweb-2/ --repo-type dataset ``` ## Usage ```python import re import duckdb uuid_re = re.compile(r"") duckdb_path = "duckdbs/fineweb-2/fw2-deu_Latn.duckdb" con = duckdb.connect(duckdb_path, read_only=True) dump = "CC-MAIN-2013-20" uuid_urn = "" # !! Important: extract the UUID from the URN uid = uuid_re.sub("\\1", uuid_urn).replace("-", "") query = "SELECT EXISTS (SELECT 1 FROM dataset WHERE dump = ? AND id = ?)" exists = bool(con.execute(query, (dump, uuid)).fetchone()[0]) print(f"Does ID {uid} exist in {dump}? {exists}") ```