-
Notifications
You must be signed in to change notification settings - Fork 690
Add DUMP DATABASE command to export database as SQL script #2329
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
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: mathiasrw <[email protected]>
Co-authored-by: mathiasrw <[email protected]>
src/79dump.js
Outdated
| /* | ||
| // | ||
| // DUMP for Alasql.js | ||
| // Date: 07.12.2024 | ||
| // (c) 2024, Andrey Gershun | ||
| // | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed copyright header in commit 17e4c67.
test/test110-B.js
Outdated
| assert(sql.includes('CREATE TABLE one')); | ||
| assert(sql.includes('a INT')); | ||
| assert(sql.includes('b STRING')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all the tests, please assert the specific complete output we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]>
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.