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

export from duckdb #784

Open
tarasglek opened this issue Jan 15, 2025 · 0 comments
Open

export from duckdb #784

tarasglek opened this issue Jan 15, 2025 · 0 comments
Labels
db Issues related to database enhancement New feature or request

Comments

@tarasglek
Copy link
Owner

tarasglek commented Jan 15, 2025

https://duckdb.org/docs/data/json/sql_to_and_from_json.html supports wonderful constructs like

COPY (SELECT 42 AS a, 'hello' AS b) TO 'query.json'

and others like https://duckdb.org/docs/sql/statements/copy.html#copy--

After outputting to such files can do:
SELECT * FROM glob('*'); to list em;

copyFileToBuffer to load them into JS and offer for download to users.

We can pattern match whether there seems to be a copy statement and run glob(*) before/after to get a diff of files to offer to download

Algorithm:

  1. pattern match to see if query is `/^\s*\bCOPY\b.*\bTO\b/i
  2. run glob(*) to get initial list of files
  3. run query
  4. run glob(*) to find new files

Followups:

  • We should also support dropping them to reduce memory.
  • We should also support loading attachments into them.
@mulla028 mulla028 added enhancement New feature or request db Issues related to database labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db Issues related to database enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants