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

test(data:export): add NUTs for big exports #1145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cristiand391
Copy link
Member

What does this PR do?

follow up to #1140

Adds 2 test cases to cover big data exports (+1 million records) where the API splits results in multiple batches, covering both CSV and JSON output formats.

What issues does this PR fix or reference?

@@ -55,6 +58,34 @@ describe('data export bulk NUTs', () => {
await validateCsv(path.join(session.dir, 'data-project', outputFile), 'COMMA', ensureNumber(result?.totalSize));
});

it('should export +1 million records in csv format', async () => {
const outputFile = 'export-scratch-info.csv';
const command = `data export bulk -q "select id,ExpirationDate from scratchorginfo" --output-file ${outputFile} --wait 10 --json -o ${na40username}`;
Copy link
Member Author

Choose a reason for hiding this comment

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

query scratchorginfo records in our na40 hub:

➜  plugin-data git:(cd/large-bulk-export-nut) sf data query -q 'select count() from scratchorginfo' -o na40

Total number of records retrieved: 1622618.

}
);
const fieldsRes = await exec(`jq 'map(${props.map((field) => `has("${field}")`).join(' and ')}) | all' ${filePath}`, {
shell: 'pwsh',
Copy link
Member Author

@cristiand391 cristiand391 Dec 9, 2024

Choose a reason for hiding this comment

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

small refactor to remove hardcoded fields in the jq query, the caller can now pass them as an array of string. No functional changes.

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.

1 participant