# Can I create a table from parquet in duckdb with "DuckDBClient.of"?

**URL:** <https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312>\
**Category:** Help\
**Created:** [November 22, 2022, 9:21pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312 "2022-11-22T21:21:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 22, 2022, 9:21pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/1 "2022-11-22T21:21:18Z")

</div>

I can manage to create a table and then populate it from a remote parquet file:

```auto
statsdb = DuckDBClient.of()
statsdb.query(`CREATE TABLE stats AS SELECT * FROM "https://llimllib.github.io/nba_data/players_2023.parquet"`)

```

Is it possible to create the stats table via `DuckDBClient.of`, or do I need to do this CREATE TABLE?

If it is not possible, consider this a feature request - if it is I’d love to know how!

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [November 23, 2022, 8:14am UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/2 "2022-11-23T08:14:52Z")

</div>

With Observable’s client, DuckDBClient.of() is loading the duckdb library and WASM file on demand, and so it has become a Promise that you neeed to await:

> **[Parquet files directly from GitHub](https://observablehq.com/@recifs/parquet-files-directly-from-github)**
>
> As a suggestion for llimllib’s question on the forum, here’s an update to Kimmo Linna’s notebook using Observable’s DuckDBClient. The database can now be used to create a chart, such as this heatmap of the players’ ages:

---

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 23, 2022, 2:38pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/3 "2022-11-23T14:38:15Z")

</div>

yup, that’s what I’m doing already - I was trying to see if there was a way to do something like:

```auto
DuckDBClient.of({
  sometable: "https://someurl/to/a/parquet.file"
})

```

---

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 23, 2022, 2:38pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/4 "2022-11-23T14:38:52Z")

</div>

You also can actually simplify that `parquet_scan` like I did in the sample at the top of this post

---

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 23, 2022, 2:39pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/5 "2022-11-23T14:39:35Z")

</div>

The notebook I used to hack on this is here: [Figuring out how to use plot with duckdb / Bill Mill / Observable](https://observablehq.com/d/85b37a73dc1d5888)

---

<div class="post-metadata">

**Author:** ![mwhitaker](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mwhitaker/32/5969_2.png) [@mwhitaker](https://talk.observablehq.com/u/mwhitaker)\
**Post date:** [November 23, 2022, 9:10pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/6 "2022-11-23T21:10:34Z")

</div>

Here is a way to get close by mimicking the File Attachments API. Just need to return a name and a url method in a helper function.

> **[Get remote Parquet files directly](https://observablehq.com/@monitus/get-remote-parquet-files-directly)**
>
> The new DuckDBClient that is included directly in Observable for now assumes that files are loaded as File Attachments. Here is a way to load remote Parquet files directly. Note that you may have to use a proxy in case of CORS issues, but pulling...

---

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 28, 2022, 4:04pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/7 "2022-11-28T16:04:21Z")

</div>

Very neat, thank you! I had trouble figuring out the interface for the duckdb constructor.

---

<div class="post-metadata">

**Author:** ![llimllib](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/llimllib/32/4902_2.png) [@llimllib](https://talk.observablehq.com/u/llimllib)\
**Post date:** [November 28, 2022, 4:10pm UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/8 "2022-11-28T16:10:22Z")

</div>

> pulling Parquet files from GitHub seems to be OK.

Just a minor note: that’s only true of [github.io](http://github.io), it doesn’t work straight from github; I added an example to [my notebook](https://observablehq.com/d/85b37a73dc1d5888) to demonstrate

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [November 29, 2022, 8:59am UTC](https://talk.observablehq.com/t/can-i-create-a-table-from-parquet-in-duckdb-with-duckdbclient-of/7312/9 "2022-11-29T08:59:45Z")

</div>

> [@llimllib](#):
>
> it doesn’t work straight from github

It does, if you fetch the raw file:

```plaintext
https://raw.githubusercontent.com/llimllib/nba_data/main/data/players_2023.parquet

```

Helper:

```javascript
// Return the raw file path for a GitHub path.
function ghFileOf(path) {
  const url = new URL(path);
  url.host = 'raw.githubusercontent.com';
  url.pathname = url.pathname.replace(/^\/blob\//, '/');
  return `${url}`;
}

```
