-
Notifications
You must be signed in to change notification settings - Fork 557
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
Feature: Add new formatter to export data to sql like mycli #1366
Conversation
This pull request introduces 1 alert when merging b64b610 into abc03c5 - view on LGTM.com new alerts:
|
Body: New formatter is added, we can export query result to sql insertion like mycli ==== End ====
b64b610
to
59ae529
Compare
I tested this code by
So what do I need to do before this PR is reviewed? |
This pull request introduces 1 alert when merging 59ae529 into abc03c5 - view on LGTM.com new alerts:
|
@astroshot We use |
Codecov ReportBase: 84.15% // Head: 79.65% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1366 +/- ##
==========================================
- Coverage 84.15% 79.65% -4.50%
==========================================
Files 21 25 +4
Lines 2720 2954 +234
==========================================
+ Hits 2289 2353 +64
- Misses 431 601 +170
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@astroshot Your new formatter could be useful to more than just |
@j-bennet OK, I'll install The reason I didn't put this formatter to For example, in postgres, insertion sql is: INSERT INTO "user" ("id", "name", "email", "phone", "description", "created_at", "updated_at") VALUES
('1', 'Jackson', '[email protected]', '132454789', '', '2022-09-09 19:44:32.712343+08', '2022-09-09 19:44:32.712343+08')
; And in myql, it is: INSERT INTO `user` (`id`, `name`, `email`, `phone`, `description`, `created_at`, `updated_at`) VALUES
('1', 'Jackson', '[email protected]', '132454789', '', '2022-09-09 19:44:32.712343+08', '2022-09-09 19:44:32.712343+08')
; Yet I'm not familiar with oracle and Mircosoft SQL Server. So I'd like to merge this PR so that we can use it in |
Body: ==== End ====
ee738b1
to
73e99a3
Compare
You could make your formatter configurable.
Sounds good to me. Before merging, this new adapter needs some unit tests. Please add some, they don't have to be extensive. |
Sure, I'll commit unit tests later. |
Body: ==== End ====
@j-bennet Hi, I have committed unit tests, is there any more work to do before merging? |
You also want to add the new supported formats to |
@j-bennet New formatters have been added to |
@astroshot Your change is now released as part of 3.5.0. |
@j-bennet Thanks 😁 |
Description
New formatter is added to export query result to sql-insert format and sql-update format like mycli:
For example:
Checklist
changelog.rst
.AUTHORS
file (or it's already there).pip install pre-commit && pre-commit install
), and ranblack
on my code.