mrshu commited on
Commit
503d2b1
·
verified ·
1 Parent(s): 8b5719e

Card: make download-first the quick start, since remote queries can hit the anonymous rate limit

Browse files
Files changed (1) hide show
  1. README.md +16 -10
README.md CHANGED
@@ -57,24 +57,30 @@ resources such as GH Archive.
57
 
58
  ## Quick start
59
 
 
 
 
 
 
 
 
 
 
 
60
  ```python
61
  import duckdb
62
- base = "hf://datasets/NaiveNeuron/github-stars-in-context@v1.1.0"
63
- print(duckdb.sql(f"""
64
  SELECT count(*) FILTER (WHERE r.stars >= 10) AS kept, count(*) AS total
65
- FROM '{base}/repositories.parquet' r
66
- JOIN '{base}/users.parquet' u ON r.user_id = u.id
67
  WHERE u.retrieval_status = 'complete'
68
  """).fetchall())
69
  # [(1560798, 53987867)]
70
  ```
71
 
72
- Or download everything (1.57 GiB). This needs the Hugging Face CLI:
73
-
74
- ```sh
75
- hf download NaiveNeuron/github-stars-in-context --repo-type dataset --revision v1.1.0 --local-dir data
76
- (cd data && shasum -a 256 -c PARQUET-SHA256SUMS)
77
- ```
78
 
79
  ## How it was collected
80
 
 
57
 
58
  ## Quick start
59
 
60
+ Download the files once (1.57 GiB). This needs the Hugging Face CLI, or use
61
+ the `curl` commands in the code repository's README:
62
+
63
+ ```sh
64
+ hf download NaiveNeuron/github-stars-in-context --repo-type dataset --revision v1.1.0 --local-dir data
65
+ (cd data && shasum -a 256 -c PARQUET-SHA256SUMS)
66
+ ```
67
+
68
+ Then query the local files, for example with DuckDB (`pip install duckdb`):
69
+
70
  ```python
71
  import duckdb
72
+ print(duckdb.sql("""
 
73
  SELECT count(*) FILTER (WHERE r.stars >= 10) AS kept, count(*) AS total
74
+ FROM 'data/repositories.parquet' r
75
+ JOIN 'data/users.parquet' u ON r.user_id = u.id
76
  WHERE u.retrieval_status = 'complete'
77
  """).fetchall())
78
  # [(1560798, 53987867)]
79
  ```
80
 
81
+ DuckDB can also read the files remotely through `hf://` paths, but a query
82
+ over the large table sends several thousand requests and can exceed Hugging
83
+ Face's limit for anonymous access. Download the files, or log in first.
 
 
 
84
 
85
  ## How it was collected
86