When using the sfdx force:data:tree:export command, the Salesforce Developer Documentation states you can specify a file path in place of an in-line typed query (either option would follow the -q flag). I ran a simple query using the in-line version first :
sfdx:force:data:tree:export -q "SELECT Id FROM Account LIMIT 5" -d queries/accounts/ -u DevHub
And it created the json and path files without issue.
However, when I tried to swap out the in-line query for a file path directed at accountsquery.file which contains the exact same query string, I keep getting the following error:
➜ testProject sfdx force:data:tree:export -q queries/accountsquery -d queries/accounts/ -u DevHub ERROR: Invalid SOQL query: "select id from account".
Does the file need to be of a certain extension type? Is the syntax somehow different when you specify a file path? I'm not sure what I'm doing wrong, and I can't find an example of using the file path over an in-line string anywhere.