Add DUMP DATABASE command to export database as SQL script#2329
Draft
Add DUMP DATABASE command to export database as SQL script#2329
Conversation
Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
Copilot
AI
changed the title
[WIP] Add export database as SQL script functionality
Add DUMP DATABASE command to export database as SQL script
Dec 7, 2025
mathiasrw
requested changes
Dec 7, 2025
src/79dump.js
Outdated
Comment on lines
1
to
7
| /* | ||
| // | ||
| // DUMP for Alasql.js | ||
| // Date: 07.12.2024 | ||
| // (c) 2024, Andrey Gershun | ||
| // | ||
| */ |
Contributor
Author
There was a problem hiding this comment.
Done. Removed copyright header in commit 17e4c67.
test/test110-B.js
Outdated
Comment on lines
27
to
29
| assert(sql.includes('CREATE TABLE one')); | ||
| assert(sql.includes('a INT')); | ||
| assert(sql.includes('b STRING')); |
Member
There was a problem hiding this comment.
For all the tests, please assert the specific complete output we expect.
Contributor
Author
There was a problem hiding this comment.
Done. Updated all tests to assert complete expected output instead of partial includes. Also fixed NaN handling for NULL numeric values. Commit 17e4c67.
…assertions Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements
DUMPandDUMP DATABASEcommands to export database schema and data as executable SQL script, equivalent to SQLite's.dumpor MySQL'smysqldump.Changes
DUMPtoken and grammar rules toalasqlparser.jisonsrc/79dump.jswithDumpDatabaseclassCREATE TABLEstatements from table schemasINSERTstatements from table dataDUMP(current database) andDUMP DATABASE dbname(specific database)build.shconcatenation listtest/test110-B.jswith 8 test cases with complete output assertions covering edge cases including NULL handling and quote escapingUsage
Output example:
Testing
Val's Diner→'Val''s Diner')Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.