mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 21:59:16 +03:00
Merge pull request #10313 from 0xflotus/patch-15
fix: small errors in blog posts
This commit is contained in:
4 files changed
+10
-11
No files matched your search
@@ -164,9 +164,9 @@ So how does *this* work? Postgres does the same thing under the covers -- it gen
|
||||
|
||||
Let's say the application using the DB has some [Python](https://python.org) code like the following:
|
||||
|
||||
```sql
|
||||
import randrange from random
|
||||
import User from models;
|
||||
```python
|
||||
from random import randrange
|
||||
from models import User
|
||||
MAX_RANDOM_USER_ID = 1_000_000_000
|
||||
def create_user():
|
||||
"""
|
||||
@@ -175,7 +175,6 @@ def create_user():
|
||||
user_id = randrange(1, MAX_RANDOM_USER_ID)
|
||||
user = User(id=user_id, email="new@example.com", name="new user")
|
||||
db.save(user)
|
||||
|
||||
```
|
||||
|
||||
That *looks* good, but there's a problem -- [random](https://docs.python.org/3/library/random.html) is a *pseudorandom* generator.
|
||||
@@ -348,7 +347,7 @@ Unfortunately, `uuid-ossp` isn't *quite* so advanced as to have many of these ne
|
||||
|
||||
[pg_idkit](https://github.com/t3hmrman/pg_idkit) is built with Rust, so it gives us access to the following ID generation crates:
|
||||
|
||||
- [nanoid](https://crates.io/crates/nanoid) (a [well known package](https://www.npmjs.com/package/nanoid) from the the NodeJS ecosystem)
|
||||
- [nanoid](https://crates.io/crates/nanoid) (a [well known package](https://www.npmjs.com/package/nanoid) from the NodeJS ecosystem)
|
||||
- [ksuid](https://crates.io/crates/ksuid)
|
||||
- [ulid](https://crates.io/crates/ulid)
|
||||
- [rs-snowflake](https://crates.io/crates/rs-snowflake) (Twitter's Snowflake algorithm)
|
||||
|
||||
@@ -79,7 +79,7 @@ It has a lot of potential though. Some ideas we'll be playing with over the next
|
||||
- **Documentation:** for tutorials and demos.
|
||||
- **Offline data:** running it in the browser for an offline cache, similar to [sql.js](https://sql.js.org/#/) or [absurd-sql](https://github.com/jlongster/absurd-sql).
|
||||
- **Offline data analysis:** using it in a dashboard for offline data analysis and charts.
|
||||
- **Testing:** testing PostgresSQL functions, triggers, data modeling, logical replication, etc.
|
||||
- **Testing:** testing PostgreSQL functions, triggers, data modeling, logical replication, etc.
|
||||
- **Dev environments:** use it as a development environment — pull data from production or push new data, functions, triggers, views up to production.
|
||||
- **Snapshots:** create a test version of your database with sample data, then take a snapshot to send to other developers.
|
||||
- **Support:** send snapshots of your database to support personnel to demonstrate an issue you're having.
|
||||
@@ -97,7 +97,7 @@ See [source code](https://github.com/snaplet/postgres-browser/tree/main/packages
|
||||
|
||||
### Web application
|
||||
|
||||
Next, we need to run the the VM inside our browser. How? [WASM](https://en.wikipedia.org/wiki/WebAssembly).
|
||||
Next, we need to run the VM inside our browser. How? [WASM](https://en.wikipedia.org/wiki/WebAssembly).
|
||||
We use [v86](https://github.com/copy/v86) to run our VM inside the browser. Our demo application is very simple - plain HTML and some basic styling.
|
||||
|
||||
See [source code](https://github.com/snaplet/postgres-browser/tree/main/packages/pg-browser).
|
||||
@@ -147,7 +147,7 @@ We achieve this by mounting a compressed [9P filesystem](<https://en.wikipedia.o
|
||||
renames every file an 8-character name and produces a `filesystem.json` file representing a nested structure with files, original file names, sizes, etc.
|
||||
We then [copy this compressed output](https://github.com/supabase-community/postgres-wasm/blob/main/packages/buildroot/config/board/pg-browser/post-image.sh) to the VM.
|
||||
We modified the kernel command line and v86 boot parameters to boot directly from the 9P filesystem, and even put our kernel file into the p9 filesystem.
|
||||
All non-essential files are loaded asyncrhonously over HTTPS in the browser as needed.
|
||||
All non-essential files are loaded asynchronously over HTTPS in the browser as needed.
|
||||
|
||||
The initial state was smaller, but still 15-20mb in size. We discussed this with Fabian who pointed us towards the `page_poison=on` kernel parameter.
|
||||
This parameter allowed us to clear caches before creating the snapshots, by forcing Linux to write arbitrary bytes on freed memory instead of random bytes,
|
||||
|
||||
@@ -348,7 +348,7 @@ _Quentin de Quelen, Meilisearch CEO_
|
||||
|
||||
### Typesense
|
||||
|
||||
> Some more context around Typesense's behavior: how loose or exact matches are done are configurable in Typesense. For eg, you can configure the number of typos that are accounted for (num_typos), and when typo tolerance should kick-in, only if a configurable amount of results are not found (typo_tokens_treshold). For multi keyword searches, you can configure Typesense to expand the search by dropping some of the keywords, until at least a configurable number of search results are found (drop_tokens_threshold).
|
||||
> Some more context around Typesense's behavior: how loose or exact matches are done are configurable in Typesense. For eg, you can configure the number of typos that are accounted for (num_typos), and when typo tolerance should kick-in, only if a configurable amount of results are not found (typo_tokens_threshold). For multi keyword searches, you can configure Typesense to expand the search by dropping some of the keywords, until at least a configurable number of search results are found (drop_tokens_threshold).
|
||||
> We've chosen specifically to keep the search tight because we received feedback from users that some results were confusing if we let the defaults be too loose.
|
||||
|
||||
_Jason Bosco, Typesense CEO_
|
||||
|
||||
@@ -43,7 +43,7 @@ The Auth team published an in-depth doc explaining how Supabase Auth supports se
|
||||
|
||||

|
||||
|
||||
Do you have 100% code coverage? Probably not, because that’s usually the last thing you think of, but *definitely* not if you don’t have database tests. We just shipped a framework for Database Tests which makes it incredibly easy to test your database using pgTAP an pg_prove.
|
||||
Do you have 100% code coverage? Probably not, because that’s usually the last thing you think of, but *definitely* not if you don’t have database tests. We just shipped a framework for Database Tests which makes it incredibly easy to test your database using pgTAP and pg_prove.
|
||||
|
||||
[Read the docs](https://supabase.com/docs/guides/database/testing).
|
||||
|
||||
@@ -96,7 +96,7 @@ If you want to see +100 other apps, check [the replies](https://twitter.com/supa
|
||||
|
||||
## Launch Week 6 date announced
|
||||
|
||||
We are ending 2022 on a high note ✊. Mark your calendars: Launch Week 6 is happenning on **December 12-16**.
|
||||
We are ending 2022 on a high note ✊. Mark your calendars: Launch Week 6 is happening on **December 12-16**.
|
||||
|
||||
In the meantime, [revisit LW5](https://supabase.com/launch-week).
|
||||
|
||||
|
||||
Reference in new issue
Block a user