Skip to content
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 a soqlqueryfile parameter to allow longer queries #327

Merged
merged 3 commits into from
Jul 26, 2022

Conversation

WillieRuemmele
Copy link
Contributor

What does this PR do?

adds a --soqlqueryfile flag to contain larger SOQL queries
exclusive to --query

What issues does this PR fix or reference?

@W-9036554@
forcedotcom/cli#360

Copy link
Member

@cristiand391 cristiand391 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure the soql command throws an err when if no query flag is passed in and also if both are specified.

@cristiand391
Copy link
Member

QA notes:

✅ reads query from file specified by --soqlqueryfile:

➜  plugin-data git:(wr/queryFromFile) ✗ cat query.txt
SELECT Id, Status FROM ScratchOrgInfo LIMIT 2%
➜  plugin-data git:(wr/queryFromFile) ✗ ./bin/run force:data:soql:query -u cd -f ./query.txt
 ID                 STATUS
 ────────────────── ───────
 2SRB00000004qu5OAA Deleted
 2SRB00000004qtqOAA Deleted
Total number of records retrieved: 2.
Querying Data... done

✅ throws an error if file doesn't exist:

➜  plugin-data git:(wr/queryFromFile) ✗ ./bin/run force:data:soql:query -u cd -f ./test.txt
Querying Data... done
ERROR running force:data:soql:query:  ENOENT: no such file or directory, open './test.txt'
➜  plugin-data git:(wr/queryFromFile) ✗ echo $?
1

✅ still reads query from --query flag:

➜  plugin-data git:(wr/queryFromFile) ✗ ./bin/run force:data:soql:query -u cd -q 'SELECT Id, Status FROM ScratchOrgInfo LIMIT 2'
 ID                 STATUS
 ────────────────── ───────
 2SRB00000004qu5OAA Deleted
 2SRB00000004qtqOAA Deleted
Total number of records retrieved: 2.
Querying Data... done

✅ JSON output matches (same query specified with (--query and --soqlqueryfile)

✅ command throws an error when both query flags are specified:

➜  plugin-data git:(wr/queryFromFile) ✗ ./bin/run force:data:soql:query -u cd -q 'SELECT Id, Status FROM ScratchOrgInfo LIMIT 2' -f query.txt
ERROR running force:data:soql:query:  --soqlqueryfile= cannot also be provided when using --query=
➜  plugin-data git:(wr/queryFromFile) ✗ echo $?
1

✅ command throws an error if no query flags are specified:

➜  plugin-data git:(wr/queryFromFile) ✗ ./bin/run force:data:soql:query -u cd
ERROR running force:data:soql:query:  Exactly one of the following must be provided: --query, --soqlqueryfile
➜  plugin-data git:(wr/queryFromFile) ✗ echo $?
1

@cristiand391 cristiand391 merged commit 966096d into main Jul 26, 2022
@cristiand391 cristiand391 deleted the wr/queryFromFile branch July 26, 2022 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants