import{s as O,n as ee,o as te}from"../chunks/scheduler.d6170356.js";import{S as se,i as ae,g as p,s as l,r as U,A as le,h as r,f as s,c as n,j as D,u as _,x as M,k as K,y as ne,a,v as $,d as J,t as G,w as Z}from"../chunks/index.fcd4cc08.js";import{C as L}from"../chunks/CodeBlock.7b16bdef.js";import{H as ie}from"../chunks/Heading.8660bd0e.js";function pe(W){let i,j,T,S,o,R,m,I=`<a href="https://github.com/duckdb/duckdb" rel="nofollow">DuckDB</a> is an in-process SQL <a href="https://en.wikipedia.org/wiki/Online_analytical_processing" rel="nofollow">OLAP</a> database management system.
Since it supports <a href="https://filesystem-spec.readthedocs.io" rel="nofollow">fsspec</a> to read and write remote data, you can use the Hugging Face paths (<a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow"><code>hf://</code></a>) to read and write data on the Hub:`,H,c,P='First you need to <a href="../huggingface_hub/quick-start#login">Login with your Hugging Face account</a>, for example using:',C,h,F,d,Q='Then you can <a href="../huggingface_hub/quick-start#create-a-repository">Create a dataset repository</a>, for example using:',Y,f,x,g,B='Finally, you can use [Hugging Face paths](<a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system#integrations" rel="nofollow">Hugging Face paths</a>) in DuckDB:',V,u,X,y,z=`This creates a file <code>data.parquet</code> in the dataset repository <code>username/my_dataset</code> containing your dataset in Parquet format.
You can reload it later:`,v,k,N,w,A='To have more information on the Hugging Face paths and how they are implemented, please refer to the <a href="https://huggingface.co/docs/huggingface_hub/guides/hf_file_system" rel="nofollow">the client library’s documentation on the HfFileSystem</a>.',q,b,E;return o=new ie({props:{title:"DuckDB",local:"duckdb",headingTag:"h1"}}),h=new L({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login',wrap:!1}}),f=new L({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmQXBpJTBBJTBBSGZBcGkoKS5jcmVhdGVfcmVwbyhyZXBvX2lkJTNEJTIydXNlcm5hbWUlMkZteV9kYXRhc2V0JTIyJTJDJTIwcmVwb190eXBlJTNEJTIyZGF0YXNldCUyMik=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfApi

HfApi().create_repo(repo_id=<span class="hljs-string">&quot;username/my_dataset&quot;</span>, repo_type=<span class="hljs-string">&quot;dataset&quot;</span>)`,wrap:!1}}),u=new L({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmRmlsZVN5c3RlbSUwQWltcG9ydCUyMGR1Y2tkYiUwQSUwQWZzJTIwJTNEJTIwSGZGaWxlU3lzdGVtKCklMEFkdWNrZGIucmVnaXN0ZXJfZmlsZXN5c3RlbShmcyklMEFkdWNrZGIuc3FsKCUyMkNPUFklMjB0YmwlMjBUTyUyMCdoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGZGF0YS5wYXJxdWV0JyUyMChGT1JNQVQlMjBQQVJRVUVUKSUzQiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfFileSystem
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> duckdb

<span class="hljs-meta">&gt;&gt;&gt; </span>fs = HfFileSystem()
<span class="hljs-meta">&gt;&gt;&gt; </span>duckdb.register_filesystem(fs)
<span class="hljs-meta">&gt;&gt;&gt; </span>duckdb.sql(<span class="hljs-string">&quot;COPY tbl TO &#x27;hf://datasets/username/my_dataset/data.parquet&#x27; (FORMAT PARQUET);&quot;</span>)`,wrap:!1}}),k=new L({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMEhmRmlsZVN5c3RlbSUwQWltcG9ydCUyMGR1Y2tkYiUwQSUwQWZzJTIwJTNEJTIwSGZGaWxlU3lzdGVtKCklMEFkdWNrZGIucmVnaXN0ZXJfZmlsZXN5c3RlbShmcyklMEFkZiUyMCUzRCUyMGR1Y2tkYi5xdWVyeSglMjJTRUxFQ1QlMjAqJTIwRlJPTSUyMCdoZiUzQSUyRiUyRmRhdGFzZXRzJTJGdXNlcm5hbWUlMkZteV9kYXRhc2V0JTJGZGF0YS5wYXJxdWV0JyUyMExJTUlUJTIwMTAlM0IlMjIpLmRmKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> HfFileSystem
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> duckdb

<span class="hljs-meta">&gt;&gt;&gt; </span>fs = HfFileSystem()
<span class="hljs-meta">&gt;&gt;&gt; </span>duckdb.register_filesystem(fs)
<span class="hljs-meta">&gt;&gt;&gt; </span>df = duckdb.query(<span class="hljs-string">&quot;SELECT * FROM &#x27;hf://datasets/username/my_dataset/data.parquet&#x27; LIMIT 10;&quot;</span>).df()`,wrap:!1}}),{c(){i=p("meta"),j=l(),T=p("p"),S=l(),U(o.$$.fragment),R=l(),m=p("p"),m.innerHTML=I,H=l(),c=p("p"),c.innerHTML=P,C=l(),U(h.$$.fragment),F=l(),d=p("p"),d.innerHTML=Q,Y=l(),U(f.$$.fragment),x=l(),g=p("p"),g.innerHTML=B,V=l(),U(u.$$.fragment),X=l(),y=p("p"),y.innerHTML=z,v=l(),U(k.$$.fragment),N=l(),w=p("p"),w.innerHTML=A,q=l(),b=p("p"),this.h()},l(e){const t=le("svelte-u9bgzb",document.head);i=r(t,"META",{name:!0,content:!0}),t.forEach(s),j=n(e),T=r(e,"P",{}),D(T).forEach(s),S=n(e),_(o.$$.fragment,e),R=n(e),m=r(e,"P",{"data-svelte-h":!0}),M(m)!=="svelte-16upv1p"&&(m.innerHTML=I),H=n(e),c=r(e,"P",{"data-svelte-h":!0}),M(c)!=="svelte-1hbzj8b"&&(c.innerHTML=P),C=n(e),_(h.$$.fragment,e),F=n(e),d=r(e,"P",{"data-svelte-h":!0}),M(d)!=="svelte-1tu70ef"&&(d.innerHTML=Q),Y=n(e),_(f.$$.fragment,e),x=n(e),g=r(e,"P",{"data-svelte-h":!0}),M(g)!=="svelte-8tw6zv"&&(g.innerHTML=B),V=n(e),_(u.$$.fragment,e),X=n(e),y=r(e,"P",{"data-svelte-h":!0}),M(y)!=="svelte-1eb1lq2"&&(y.innerHTML=z),v=n(e),_(k.$$.fragment,e),N=n(e),w=r(e,"P",{"data-svelte-h":!0}),M(w)!=="svelte-1o8dsbk"&&(w.innerHTML=A),q=n(e),b=r(e,"P",{}),D(b).forEach(s),this.h()},h(){K(i,"name","hf:doc:metadata"),K(i,"content",re)},m(e,t){ne(document.head,i),a(e,j,t),a(e,T,t),a(e,S,t),$(o,e,t),a(e,R,t),a(e,m,t),a(e,H,t),a(e,c,t),a(e,C,t),$(h,e,t),a(e,F,t),a(e,d,t),a(e,Y,t),$(f,e,t),a(e,x,t),a(e,g,t),a(e,V,t),$(u,e,t),a(e,X,t),a(e,y,t),a(e,v,t),$(k,e,t),a(e,N,t),a(e,w,t),a(e,q,t),a(e,b,t),E=!0},p:ee,i(e){E||(J(o.$$.fragment,e),J(h.$$.fragment,e),J(f.$$.fragment,e),J(u.$$.fragment,e),J(k.$$.fragment,e),E=!0)},o(e){G(o.$$.fragment,e),G(h.$$.fragment,e),G(f.$$.fragment,e),G(u.$$.fragment,e),G(k.$$.fragment,e),E=!1},d(e){e&&(s(j),s(T),s(S),s(R),s(m),s(H),s(c),s(C),s(F),s(d),s(Y),s(x),s(g),s(V),s(X),s(y),s(v),s(N),s(w),s(q),s(b)),s(i),Z(o,e),Z(h,e),Z(f,e),Z(u,e),Z(k,e)}}}const re='{"title":"DuckDB","local":"duckdb","sections":[],"depth":1}';function oe(W){return te(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends se{constructor(i){super(),ae(this,i,oe,pe,O,{})}}export{fe as component};
