-
Notifications
You must be signed in to change notification settings - Fork 22
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
add: option to only import/export selected collections to/from a DB #88
add: option to only import/export selected collections to/from a DB #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! 🙇♂️
Do you have a use case where someone wants to export only a subset of collections, and deleting the other collections is not an option?
err = c.persistMetadata() | ||
if err != nil { | ||
return fmt.Errorf("couldn't persist collection metadata: %w", err) | ||
} | ||
for _, doc := range c.documents { | ||
docPath := c.getDocPath(doc.ID) | ||
err = persistToFile(docPath, doc, c.compress, "") | ||
if err != nil { | ||
return fmt.Errorf("couldn't persist document to %q: %w", docPath, err) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, good point! 👍
If you want you can split this into two PRs, one for the fix/improvement, and one for the new feature. But up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't have any other change requests apart from the now-resolved ones, I'd leave this in one PR, if you don't mind :)
Yeah, over in our gptscript-ai/knowledge tool, we're playing around with sharing knowledge bases (datasets/collections). |
Co-authored-by: Philipp Gillé <[email protected]>
22b5e2e
to
a4a5653
Compare
Ah right, the existing DB can still be a persistent one where you continue to use all existing collections, and the export is just for sharing, not for backing up or as an alternative to the immediate persistence. 👍 Thanks again 🙇♂️ |
This PR does two things:
collections
parameter to the (non-deprecated) import/export functions so one can import/export only selected collections