-
Notifications
You must be signed in to change notification settings - Fork 56
Raw tables #654
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
Raw tables #654
Conversation
🦋 Changeset detectedLatest commit: 2017270 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
This looks very good. I had some minor questions.
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.
I'm happy with this from my side.
This adds support for "raw tables", which are managed by the user instead of being created as JSON views by PowerSync. Benefits include better performance for complex queries as well as support for more complex table definitions (including local table and column constraints).
To enable raw tables, one would currently first create a regular schema and then call
withRawTables
to add them (not sure if we should have a secondary parameter on theSchema
constructor for this - perhaps after stabilizing this feature?). Raw tables consist of:PUT
ops.REMOVE
ops.The statements are defined as SQL with prepared statement parameters as well as a value source (which can currently either be the id column or a named column extracted from JSON). The syntax for that is not particularly nice at the moment (it reflects the internal JSON structure used by the core extension). There are multiple options to improve that here, but since the feature is explicitly marked as experimental we can improve on API changes once we better understand how this feature is used in practice.