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 Dataset.exportToValue #1553

Merged
merged 11 commits into from
Sep 23, 2022
Merged

feat: add Dataset.exportToValue #1553

merged 11 commits into from
Sep 23, 2022

Conversation

mstephen19
Copy link
Contributor

closes #1523

Allows the entirety of the dataset's contents to be saved to a key-value store under a custom key, and with a custom contentType.

@szmarczak szmarczak changed the title feat(Dataset): saveToValue method feat(Dataset): exportToValue method Sep 20, 2022
packages/core/src/storages/dataset.ts Outdated Show resolved Hide resolved
packages/core/src/storages/dataset.ts Outdated Show resolved Hide resolved
packages/core/src/storages/dataset.ts Outdated Show resolved Hide resolved
mstephen19 and others added 4 commits September 21, 2022 23:39
Co-authored-by: Martin Adámek <banan23@gmail.com>
Co-authored-by: Martin Adámek <banan23@gmail.com>
Co-authored-by: Martin Adámek <banan23@gmail.com>
packages/core/src/storages/dataset.ts Outdated Show resolved Hide resolved
@B4nan B4nan changed the title feat(Dataset): exportToValue method feat: add Dataset.exportToValue Sep 23, 2022
@B4nan B4nan merged commit acc6344 into master Sep 23, 2022
@B4nan B4nan deleted the dataset-save-to-one-file branch September 23, 2022 11:25
Comment on lines +300 to +301
await kvStore.setValue(key || 'OUTPUT', await this.client.listItems(), recordOptions);
}
Copy link
Member

@mnmkng mnmkng Sep 23, 2022

Choose a reason for hiding this comment

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

@mstephen19 @B4nan what's the contentType option for when there's no way to actually output a different thing than a JSON? It's not gonna magically turn to CSV just by setting the content type to it 😅 It's just gonna create a corrupted file

Also listItems() might be absolutely huge. This needs to be done in a streaming fashion.

Finally, the exported JSON (or CSV) should include just items and not the whole object with pagination information.

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.

Add functions to save dataset as JSON or CSV
3 participants