-
Notifications
You must be signed in to change notification settings - Fork 110
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
One-off query support #198
Conversation
About what queries we support, is all that specified in https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/sqltest when running the validation suite. In concrete https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/sqltest/test/basic are examples of valid queries. |
Check
|
@mamcx thanks. Question: I noticed https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/core/src/sql/execute.rs#L86 returns a Vec of Memtables. When will this Vec contain more than one entry? |
For example in SELECT * FROM table1;SELECT * FROM table2 You can run SQL queries with the cli: spacetime sql quickstart --interactive |
6696648
to
25dd93b
Compare
This is ready for review @cloutiertyler. Ended up quite short, but I ran into a number of bugs in the process (mainly of my own creation), which ate up a lot of time. |
And the commit message should probably not say it is ENTIRELY UNTESTED when it lands :) |
Rebased and squashed, comments addressed. This should be ready for merge |
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 seems good to me. I also like the with_read_only
fn.
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 was finally able to get this working after some futzing with Unity. I opened this PR to eventually add support for this to our UnitySDK: https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/pull/2/files
I've attributed @kazimuth to the commit in the PR. Also @kazimuth would you be willing to write some documentation for this on the website? Maybe it should be part of the API reference. In the future I will work this into the Unity tutorial so that there's better visibility on this.
Thank you James, this is awesome 👍
Description of Changes
Support one-off queries without establishing a subscription. Took me a while to figure out all the routing. This is (NO LONGER) TOTALLY UNTESTED.
The SQL engine seems to support returning multiple tables so I've routed that through to the client, but I have no idea what queries would actually use that -- @mamcx ?
Also, I don't know how to validate that a query only SELECTs and doesn't do anything else.
@jdetter