feat: add verbose flag to bulk delete and upsert#615
feat: add verbose flag to bulk delete and upsert#615WillieRuemmele merged 6 commits intosalesforcecli:mainfrom
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
Id
<Some non-existing Id>
"sf__Id","sf__Error",Id
"","MALFORMED_ID:malformed id <ID>:--","<ID>"[2] Testcase "should not print table because
Id
<Tracked Id of Account to be deleted>
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
--verboseflag to thesf data delete bulkandsf data upsert bulkcommands. If set, failed records will be printed as table:What issues does this PR fix or reference?
forcedotcom/cli#2221
Discussion
node-fetchlibrary which is used byBulkApiV2.requestbut this is quite hard to accomplish. Maybe someone has some other ideas?--jsonis set. This is because otherwise the printed JSON would be malformed.Idcolumn? The only thing we know for sure is that SF will give us thesf__Idcolumn. 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 sourceIdcolumn (or external id in case of upsert) printed here. This might end in a different implementation forupsertanddelete.