J0nasW commited on
Commit
ba77c77
·
verified ·
1 Parent(s): f4426d9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +35 -1
README.md CHANGED
@@ -210,10 +210,44 @@ Cross-ontology links discovered via shared external IDs (UMLS, Wikidata, MESH, e
210
 
211
  ## Usage with DuckDB
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  ```python
214
  import duckdb
215
 
216
- # Query directly from HuggingFace
217
  con = duckdb.connect()
218
  con.execute("INSTALL httpfs; LOAD httpfs;")
219
 
 
210
 
211
  ## Usage with DuckDB
212
 
213
+ ### Option 1: Pre-built database file (recommended)
214
+
215
+ This repository includes a ready-to-use DuckDB database file (`datalake.duckdb`, 274 KB) with 145 SQL views pre-configured to read directly from HuggingFace. Download just this one file and query all 7 datasets immediately — no pipeline setup required.
216
+
217
+ ```python
218
+ import duckdb
219
+
220
+ con = duckdb.connect()
221
+ con.execute("INSTALL httpfs; LOAD httpfs;")
222
+ con.execute("ATTACH 'hf://datasets/J0nasW/science-datalake/datalake.duckdb' AS lake")
223
+
224
+ # Query using familiar schema.table syntax
225
+ df = con.execute("""
226
+ SELECT doi, title, year, sciscinet_disruption, oa_cited_by_count
227
+ FROM lake.xref.unified_papers
228
+ WHERE sciscinet_disruption IS NOT NULL
229
+ ORDER BY sciscinet_disruption DESC
230
+ LIMIT 100
231
+ """).df()
232
+
233
+ # Cross-source joins work out of the box
234
+ con.execute("""
235
+ SELECT t.display_name AS topic, o.ontology, o.term_name, o.similarity
236
+ FROM lake.xref.topic_ontology_map o
237
+ JOIN lake.openalex.topics t ON t.id = o.topic_id
238
+ WHERE o.similarity >= 0.85
239
+ ORDER BY o.similarity DESC
240
+ LIMIT 20
241
+ """).df()
242
+ ```
243
+
244
+ ### Option 2: Direct Parquet queries
245
+
246
+ You can also query individual Parquet files directly without the database file:
247
+
248
  ```python
249
  import duckdb
250
 
 
251
  con = duckdb.connect()
252
  con.execute("INSTALL httpfs; LOAD httpfs;")
253