-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: add verbose flag to bulk delete and upsert #615
feat: add verbose flag to bulk delete and upsert #615
Conversation
Hi @R0Wi - thanks for the contribution - this looks really good 🏆 For the testing question, I would suggest writing a few NUTs (not unit tests) for this, checkout the Running the NUTs locally might be slightly inconvent for you, it requires a dev hub that can create a scratch org... so if you want, if you provide the data, commands, and expected behavior, I could write the tests too For the id question... would it make sense to include both of the IDs? maybe one as |
That sounds great! For my personal tests I used the following setup: [1] Testcase "should print table because
[2] Testcase "should not print table because
Other Testcases can be setup by combining the above approach with Please let me know if you need further information.
Yes, makes sense. Depending on the concrete operation the |
Awesome @R0Wi - I've added those tests, that in theory, following your test scenarios, should pass... they might need to be tweaked based on some changes you make... I did notice that the table is being printed in ➜ ../../oss/rowi-data/bin/dev data:delete:bulk --file data.csv --sobject Account --verbose --wait 10 --json
Bulk Failures [1]
====================================================
| Id Error
| ── ───────────────────────────────────────────────
| MALFORMED_ID:malformed id 123e1232133nugGQAQ:--
{
"status": 1,
"result": {
"jobInfo": { so it seems like |
Great, thank you! Yes I already noticed that. Will commit a fix tomorrow :-) |
* Remove default value for boolean flags * Print both Id (if exists) and Sf_Id columns * Only print table if --json is not set * Only download results if either --json or --verbose is set * Adjust, add and format tests
Hi @WillieRuemmele, I adjusted the code a bit and "manually" tested the testcases. They are now working for me. Think that's it from my end at the moment, any feedback appreciated 🚀 PS: one thing came to my mind regarding tests: currently we do not have any tests for the |
3cc7e7c
to
41cc86a
Compare
all tests passed and validated, thanks for the contribution, this will be in the Thanks for your contribution @R0Wi 🏆 ❤️ |
What does this PR do?
This adds a
--verbose
flag to thesf data delete bulk
andsf data upsert bulk
commands. If set, failed records will be printed as table:What issues does this PR fix or reference?
forcedotcom/cli#2221
Discussion
node-fetch
library which is used byBulkApiV2.request
but this is quite hard to accomplish. Maybe someone has some other ideas?--json
is set. This is because otherwise the printed JSON would be malformed.Id
column? The only thing we know for sure is that SF will give us thesf__Id
column. But if an error occures (for example when trying to delete records) this column won't be filled and it might make more sense to have the actual sourceId
column (or external id in case of upsert) printed here. This might end in a different implementation forupsert
anddelete
.