Allow importing data when the SurrealDB server starts#5120
Merged
Conversation
tobiemh
approved these changes
Nov 15, 2024
kearfy
approved these changes
Nov 15, 2024
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for submitting this pull request. We really appreciate you spending the time to work on SurrealDB. 🚀 🎉
What is the motivation?
To address uses cases that require that certain resources exist in the datastore when the server is started.
What does this change do?
This feature will import a file containing SurrealQL queries to the datastore with
ownerpermissions onROOTbefore the server is started. This feature functions similarly to theimportsub-command. While the flag is present, the file will be imported every time that the server is started; this allows creating users, access methods and any other resources or data that clients may need to rely on. An informational message is logged on the server whenever data is imported from a file on start.From a security perspective, this feature is used when starting the server and hence already requires complete access to the datastore, which is extended to the import file. On the other hand, this feature provides an alternative to the
-uand-pflags that would create a root-level owner user when starting the server for the first time, allowing users to instead rely on more secure paswordless access methods, which can also be kept updated when restarting the server.What is your testing strategy?
Implement integration tests for the basic import functionality, the effect on a restart in any imported resources, the creation of resources at different levels and the requirement of providing an existent file.
Is this related to any issues?
No.
Does this change need documentation?
Yes, this requires updating the CLI documentation for the
startcommand.Have you read the Contributing Guidelines?