Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define sql connectors to live data #1072

Closed
Fil opened this issue Mar 15, 2024 · 4 comments · Fixed by #1097
Closed

Define sql connectors to live data #1072

Fil opened this issue Mar 15, 2024 · 4 comments · Fixed by #1097
Labels
enhancement New feature or request

Comments

@Fil
Copy link
Contributor

Fil commented Mar 15, 2024

---
sql:
  mytable: ${a live expression}
---
@Fil Fil added the enhancement New feature or request label Mar 15, 2024
@mbostock
Copy link
Member

What is this? I don’t think we want this. It goes against static analysis. You can do this by manually declaring a DuckDBClient as shown in other issues but I’m pretty strongly opposed to putting reactive JavaScript expressions within front matter.

@Fil
Copy link
Contributor Author

Fil commented Mar 15, 2024

The idea is that sql fenced blocks are so great to use, I'm trying to find the shortest route to them from live data.

@mbostock
Copy link
Member

mbostock commented Mar 15, 2024

Maybe then we should make this pattern more discoverable?

const db = await DuckDBClient.of({gaia: FileAttachment("./lib/gaia-sample.parquet")});
const sql = db.sql.bind(db);

Such as this:

const sql = DuckDBClient.sql({gaia: FileAttachment("./lib/gaia-sample.parquet")});

@Fil
Copy link
Contributor Author

Fil commented Mar 15, 2024

sounds like the 🚀 solution

Fil added a commit that referenced this issue Mar 18, 2024
@Fil Fil mentioned this issue Mar 18, 2024
mbostock added a commit that referenced this issue Mar 18, 2024
* implement sql fenced code from DuckDBClient.sql(…)

following @mbostock’s suggestion #1072 (comment)

* fix typo

---------

Co-authored-by: Mike Bostock <mbostock@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants