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

Add best practices for Spacetime SQL #180

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

joshua-spacetime
Copy link
Contributor

Closes #179

@joshua-spacetime joshua-spacetime force-pushed the joshua/sql-best-practices branch from 8f9d1cb to 334f0ac Compare February 24, 2025 22:09
Copy link
Contributor

@mamcx mamcx left a comment

Choose a reason for hiding this comment

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

LGTM

@joshua-spacetime joshua-spacetime merged commit 675882c into master Feb 25, 2025
5 checks passed
@joshua-spacetime joshua-spacetime deleted the joshua/sql-best-practices branch February 25, 2025 16:59
gefjon added a commit that referenced this pull request Mar 4, 2025
* Changed subscript to SubscribeToAllTables (#155)

Missed updating the HandleConnect from `Subscribe("SELECT * FROM *"` to `SubscribeToAllTables()` in the updated code block on page 3.

* Updated the TypeScript quickstart guide to use the new 1.0 API (#141)

* Updated the quickstart guide to use the new 1.0 API

* Completed quickstart rewrite

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Clarification

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Wrong type of quotes

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs/sdks/typescript/quickstart.md

Co-authored-by: Phoebe Goldman <[email protected]>

* Apply suggestions from code review

Co-authored-by: Phoebe Goldman <[email protected]>
Co-authored-by: rekhoff <[email protected]>

* Address review comments

---------

Co-authored-by: Phoebe Goldman <[email protected]>
Co-authored-by: rekhoff <[email protected]>

* Update Rust client SDK docs for SpacetimeDB#2118 (#130)

* docs(70): The 1.0 SQL spec

Closes #70.

* Small TS SDK Quickstart Fixes (#157)

Updated quickstart url

* Style guide: add formatting advice for GUI elements and menu paths (#129)

* Style guide: add formatting advice for menu items

* Generalize guidance to all GUI elements, not just menu paths

* Remove WebSocket api docs and all references to them (#165)

Closes #164.

---------

Co-authored-by: Phoebe Goldman <[email protected]>

* CLI docs (#168)

* [bfops/cli-docs]: CLI docs

* [bfops/cli-docs]: fix?

* [bfops/cli-docs]: manual backticks

* [bfops/cli-docs]: manual bold

* [bfops/cli-docs]: manual bold

* [bfops/cli-docs]: add README for maintaining CLI reference docs

* [bfops/cli-docs]: maybe fix code?

* [bfops/cli-docs]: tweak <code>

* [bfops/cli-docs]: tweak code

* [bfops/cli-docs]: update

---------

Co-authored-by: Zeke Foppa <[email protected]>

* Add link to the `cli` (#171)

* Rename satn.md -> sats-json.md (#158)

* Fix auto_inc attribute name (#175)

* Document LIMIT and COUNT (#178)

Closes #177.

* Add best practices for Spacetime SQL (#180)

Closes #179.

* API for mutable subscriptions (#166)

Closes #78.

Includes rust and csharp examples.

* Remove references to SpacetimeDB 0.6

Closes #118.

* Remove reference to set energy-balance in http api

Closes #119.

* Remove references to testnet

Closes #183.

* Remove 0.12 migration guide

* Update to C# Quickstart-Chat Server Module and Client SDK tutorial documents (#170)

* Initial code pass on updating server to 1.0.0

* Updated to work with current 1.0.0-rc4, master branches of SpacetimeDB and the CSharpSDK

* Minor edit for clarity

* No longer optional, ReducerContext is always the first argument

Co-authored-by: Phoebe Goldman <[email protected]>

* Improved description of OnInsert and OnDelete callbacks

Co-authored-by: Phoebe Goldman <[email protected]>

* Fixed capitalization.

Co-authored-by: Phoebe Goldman <[email protected]>

* Fixed capitalization.

Co-authored-by: Phoebe Goldman <[email protected]>

* SDK language corrected and clarified.

Co-authored-by: Phoebe Goldman <[email protected]>

* Added that the example is for the C# client and does not include server examples.

Co-authored-by: Phoebe Goldman <[email protected]>

* Added comma for clarity

Co-authored-by: Phoebe Goldman <[email protected]>

* Added comma for clarity

Co-authored-by: Phoebe Goldman <[email protected]>

* Applied requested changes to improve clarity

* Revised the SDK Client Quickstart to be more-in-line with the Rust Client Quickstart flow

* Added comments to code

* Replaced <module-name> with quickstart-chat

---------

Co-authored-by: Phoebe Goldman <[email protected]>

* Move Rust Module SDK reference to docs.rs (#114)

Move rust reference to rustdoc

* Document reducer semantics wrt. transactionality (#185)

document reducer semantics wrt. transactionality

* Document behaviour of SEQUENCES (#174)

* Document behaviour of SEQUENCES

* Update docs/appendix.md

Co-authored-by: Tyler Cloutier <[email protected]>

* Apply suggestions from code review

Co-authored-by: Phoebe Goldman <[email protected]>

---------

Co-authored-by: Tyler Cloutier <[email protected]>
Co-authored-by: Phoebe Goldman <[email protected]>

* Update Rust client SDK quickstart for 1.0 API (#162)

* Begin revising rust client quickstart: update the code

* Revise Rust client SDK quickstart

A whole bunch of stuff has changed since this document was last updated.
Notably, I've chosen to re-order a bunch of sections,
since the previous structure of the document doesn't make much sense
after the 0.12 API rework.

* Fix credentials import issue

There are still warnings here but it builds now

* Fix warnings after pasting all this code into a fresh project

---------

Co-authored-by: John Detter <[email protected]>

* Add docs for standalone config.toml (#190)

* Add docs for standalone config.toml

* Update docs/cli-reference/standalone-config.md

Co-authored-by: Phoebe Goldman <[email protected]>

* pre formatting

---------

Co-authored-by: Phoebe Goldman <[email protected]>

* Update docs for http api (#188)

* Update docs for http api

* Apply suggestions from code review

Co-authored-by: Phoebe Goldman <[email protected]>

* Remove energy page

---------

Co-authored-by: Phoebe Goldman <[email protected]>

* Update Rust SDK ref, and also a few small fixes (#172)

* *Must* accept `ReducerContext`, not *may*

* Small fixes to Rust docs for database Identity and rename Address

* Update Rust SDK reference for various 1.0 API changes

* Fix broken links

* TOC and TODOs

* Rename `Address` to `ConnectionId` in index, fix some links

* Minor fixes I found while working through converting this to typescript

* Link to SQL ref

* Additional fixups found while rewriting TS ref

* Remove references to BitCraftMini

We no longer use this as an example.

Also, I'm pretty sure we stopped using that name ages ago.

* No UB from mixing `subscribe` and `subscribe_to_all_tables`

Co-authored-by: joshua-spacetime <[email protected]>

* Update TypeScript SDK reference (#181)

* Begin updating TypeScript SDK ref to match the new rust one

* Link to SQL ref from `subscribe` method

* Fill in the rest of the TypeScript SDK ref

* Fix copy-paste error: `subscribeToAllTables` should be camelCase

Co-authored-by: joshua-spacetime <[email protected]>

* Copy change from Rust SDK docs: no UB in `subscribeToAllTables`

Co-authored-by: joshua-spacetime <[email protected]>

* Fix casing of `withModuleName`

Co-authored-by: Tyler Cloutier <[email protected]>

* Address Tyler's review

---------

Co-authored-by: joshua-spacetime <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>

---------

Co-authored-by: joshua-spacetime <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>

* How-to: Incremental Migrations (#127)

* How-to: Incremental Migrations

This commit adds a how-to guide for defining "incremental migrations,"
a strategy for updating the schema of a database while maintaining compatibility
with outdated clients and without requiring a manual migration.

The code is not on GitHub yet,
as I'd like review on my choice of example before pushing the repository.
As such, the links to the code at the bottom of the new document are broken.

* Updates following review

* Updates to blackhol.io tutorials (#194)

Updates to blackholio tutorials

Page 3 - Fix duplicate code in Rust "disconnect reducer" instructions.
Page 4 - Update use of `CallerIdentity` to `Sender` in C# instructions.

* Updated with corrected table names to lower case, for compatibility w… (#195)

Updated with corrected table names to lower case, for compatibility with other quickstart-chat languages.
Updated with additional changes in clockworklabs/com.clockworklabs.spacetimedbsdk#258

* Small doc fixes potpourri (#198)

* Remove hedging about table access from module quickstarts

We'll announce RLS when we announce it. For now, what we have is what we have.

* Remove hedging about supported module languages

This kind of thing belongs in a roadmap, not anywhere else in our docs.

* Fix :fingers_crossed: formatting of link to scheduled reducers

* Fix link

* List module langs in alphabetical order

Which also happens to be decreasing order of support and battle-tested-ness

* Re-order various and pages in sidebar

- Internals get their own section, and move down.
- Appendix gets its own section, instead of joining "Subscriptions."
- SQL and Subscriptions move up.

* Remove outdated guidance about tokens

We don't have "SpacetimeDB tokens" anymore, we just have regular OIDC JWTs.
We don't need to offer any special guidance about JWT hygiene.

* Fixes the typescript quickstart for the new subscription API (#161)

* Updated quickstart url

* DBConnection -> DbConnection for TypeScript SDK

* Updated for the subscription update

* Multiplayer bug fix in tutorial (#169)

* Multiplayer bug fix in tutorial

* Update part-4.md

Small fix

* removed reference to test input

This test input is not used during the tutorial and causes unused variable warnings

* Update part-4.md

* Add instructions for deploying to maincloud (#167)

* [bfops/deploying]: add instructions for deploying mainnet

* [bfops/deploying]: nav.ts

* [bfops/deploying]: nav.ts

* [bfops/deploying]: fix link?

* Update docs/deploying/maincloud.md

Co-authored-by: John Detter <[email protected]>

* Update docs/deploying/maincloud.md

Co-authored-by: John Detter <[email protected]>

* [bfops/deploying]: review

* Update docs/deploying/maincloud.md

Co-authored-by: Tyler Cloutier <[email protected]>

* Apply suggestions from code review

Co-authored-by: Tyler Cloutier <[email protected]>

* Add `/profile` as a known link

---------

Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: joshua-spacetime <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>
Co-authored-by: Phoebe Goldman <[email protected]>

* C# Module Library docs (#193)

* Most of the way to C# Module SDK docs

* Copy in more docs

* Mostly done

* Remove dead docs

* Apply suggestions from code review

Thanks Mazdak, also going to apply some of these to the Rust modules.

Co-authored-by: Mazdak Farrokhzad <[email protected]>
Co-authored-by: joshua-spacetime <[email protected]>

* Address review comments

---------

Co-authored-by: Mazdak Farrokhzad <[email protected]>
Co-authored-by: joshua-spacetime <[email protected]>

* C# sdk reference (#191)

Closes #192.

* Describe how a JWT's sub/iss are translated into an Identity (#204)

* Rekhoff/blackholio fixes (#205)

* Updates to blackholio tutorials

Page 3 - Fix duplicate code in Rust "disconnect reducer" instructions.
Page 4 - Update use of `CallerIdentity` to `Sender` in C# instructions.

* Fixes from running through Blackholio tutorial in Rust and C# on 1.0.0

* Minor formatting updates

* Minor formatting update

* Another minor format change

* Whitespace fix.

Co-authored-by: John Detter <[email protected]>

* Whitespace fix.

Co-authored-by: John Detter <[email protected]>

* Whitespace fix.

Co-authored-by: John Detter <[email protected]>

---------

Co-authored-by: John Detter <[email protected]>

---------

Co-authored-by: rekhoff <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>
Co-authored-by: joshua-spacetime <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: Mario Montoya <[email protected]>
Co-authored-by: Noa <[email protected]>
Co-authored-by: james gilles <[email protected]>
Co-authored-by: Mazdak Farrokhzad <[email protected]>
Co-authored-by: John Detter <[email protected]>
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.

Best practices for sql and subscriptions
2 participants