You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sqlite-cloud/platform/analyzer.mdx
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,16 +12,19 @@ import applyAnalyzer from '@docs-website-assets/introduction/video/dashboard_ana
12
12
13
13
The Analyzer panel is a powerful tool that collects and categorizes all the queries executed on your cluster based on their execution time. It allows for intelligent and proactive analysis, and provides recommendations on which indexes to use to optimize frequently used queries.
14
14
15
-
<VideoPlayersrc={enableAnalyzer} />
15
+
---
16
16
17
-
By default, the Analyzer is turned off to avoid a small performance penalty. However, you can enable it by accessing the Settings button and setting the `query_analyzer_enabled` flag to 1, then pressing Save. You can also adjust the `query_analyzer_threshold` flag to set the minimum threshold query time (in milliseconds) that triggers a query to be included in the Analyzer. If the default value is too low, it's recommended to increase it to avoid having too many queries included in the panel.
17
+
## Getting Started
18
18
19
+
By default, the Analyzer is turned off to avoid a small performance penalty. However, you can enable it by accessing the Settings button and setting the `query_analyzer_enabled` flag to 1, then pressing Save. You can also adjust the `query_analyzer_threshold` flag to set the minimum threshold query time (in milliseconds) that triggers a query to be included in the Analyzer. If the default value is too low, it's recommended to increase it to avoid having too many queries included in the panel.
20
+
<VideoPlayersrc={enableAnalyzer} />
19
21
20
22
23
+
----
21
24
## Testing the Analyzer
25
+
To test the Analyzer, we can go to the `Studio -> chinook.sqlite -> SQL Console` section and perform a query that filters the non-indexed Composer column of the Track table with the following statement: `SELECT * FROM Tracks WHERE Composer = 'AC/DC'`;
22
26
<VideoPlayersrc={applyAnalyzer} />
23
27
24
-
To test the Analyzer, we can go to the `Studio -> chinook.sqlite -> SQL Console` section and perform a query that filters the non-indexed Composer column of the Track table with the following statement: `SELECT * FROM Tracks WHERE Composer = 'AC/DC'`;
25
28
26
29
27
30
Once we have executed this query, we can go back to the Analyzer panel and see that it has been successfully analyzed by the **nxidiwbuhz** node.
Backups provide a robust solution for mitigating data loss and resolving data corruption issues. Backups are available for databases in all [Dev, Pro and Startup](https://www.sqlitecloud.io/pricing) projects.
15
14
16
15
SQLite Cloud creates a full snapshot backup of your data once a day, and stores incremental changes once per second, on commodity object storage.
17
16
17
+
----
18
+
18
19
## Features
19
20
20
21
#### Automated Backups
@@ -24,13 +25,16 @@ SQLite Cloud creates a full snapshot backup of your data once a day, and stores
24
25
-**Easy Restoration Process**: Restoring from a backup automatically overwrites the existing database, seamlessly reverting it to the desired state without additional configuration.
25
26
-**Consistency and Reliability**: After restoration, the database functions as it did at the chosen point in time, ensuring operational continuity.
26
27
28
+
29
+
---
30
+
27
31
## Getting Started
28
32
Setting up and managing backups in SQLite Cloud is designed to be straightforward, allowing you to implement robust data protection strategies effortlessly.
29
33
30
34
<VideoPlayersrc={enableDisableBackup} />
31
35
32
-
33
-
###Restoring from a Backup
36
+
---
37
+
## Restoring from a Backup
34
38
35
39
Click on a backup to begin the restore process. Select Yes to confirm the restoration, and your database will be restored to the selected point in time.
Copy file name to clipboardExpand all lines: sqlite-cloud/platform/edge-functions.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ Edge functions can be called remotely over HTTP or Websockets via API, or trigge
18
18
19
19
Turning on linearizable reads ensures strong consistency, but may introduce some latency. When eventual consistency is sufficient, we recommend leaving linearizable reads off.
20
20
21
+
---
22
+
21
23
## Getting Started
22
24
23
25
Use the **Edge Functions panel** to effortlessly create, deploy, and test Edge Functions directly in the SQLite Cloud dashboard.
@@ -67,6 +69,7 @@ Edge functions can be called via HTTP GET and POST methods. You can pass additio
67
69
- Query parameters: Accessible via `request.params`
68
70
- Request body: Accessible via `request.data`
69
71
72
+
---
70
73
71
74
## Guides
72
75
### Interacting with your Database
@@ -102,6 +105,9 @@ You can also add environment variables in the UI by navigating to the "Environme
102
105
### Handling Errors
103
106
In case of error we return an HTTP error code and a JSON with the error message. Manually throwing an error in your code results in a 500 response. You may also return an error.
104
107
108
+
109
+
---
110
+
105
111
## Examples
106
112
107
113
### Assigning and Notifying a Support Rep on User Sign up
OffSync is a powerful SQLite Cloud feature that enables true **local-first** data synchronization for your applications. Powered by the [SQLite Sync](https://github.com/sqliteai/sqlite-sync) extension, it allows you to build robust, offline-capable applications where data is stored and processed on edge devices and seamlessly synchronized with a central SQLite Cloud database.
19
17
20
18
This architecture is ideal for mobile apps, IoT devices, and any application requiring high availability and low latency, even with intermittent network connectivity. By leveraging Conflict-free Replicated Data Types (CRDTs), OffSync ensures that changes made offline are merged automatically and without conflicts when the device reconnects.
21
19
20
+
21
+
---
22
+
22
23
## How It Works
23
24
24
25
OffSync extends standard SQLite tables with built-in support for offline work and automatic synchronization. This allows multiple devices to operate independently and then seamlessly merge their changes.
@@ -29,26 +30,29 @@ OffSync extends standard SQLite tables with built-in support for offline work an
29
30
30
31
When combined with [Row-Level Security (RLS)](/docs/rls), OffSync allows you to build secure, multi-tenant applications where each user's data is safely isolated, both on the edge and in the cloud.
31
32
33
+
34
+
---
35
+
32
36
## Configuring OffSync
33
37
34
38
You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
35
39
Below are the main steps:
36
40
37
-
### 1. Enable Tables for Synchronization
41
+
### Enable Tables for Synchronization
38
42
From the **Sync Tables** tab, select which tables in your database you want to keep synchronized.
39
43
Once enabled, all changes to those tables will automatically sync with connected devices.
40
44
41
45
<VideoPlayersrc={enableSync} />
42
46
43
47
44
-
### 2. Get the Connection String
48
+
### Get the Connection String
45
49
In the **Configuration** tab, copy the connection string.
46
50
Use this in your application to initialize OffSync and connect your local SQLite database with SQLite Cloud.
47
51
48
52
<VideoPlayersrc={connectionUrlSync} />
49
53
50
54
51
-
### 3. Manage Connected Devices
55
+
### Manage Connected Devices
52
56
In the **Devices** tab, you can view all devices currently connected to your database.
53
57
Here you can check their sync status and remove devices if needed.
Row-Level Security (RLS) allows you to define fine-grained access control policies that determine which rows in a table a user can access. This ensures that users can only view or modify data they are authorized to see, enhancing data security and privacy.
@@ -24,6 +22,8 @@ RLS is a powerful feature for building secure, multi-tenant applications. When c
24
22
25
23
This architecture simplifies development by allowing your application to interact with a local database while SQLite Cloud [OffSync](/docs/offsync) transparently handles the synchronization with a central database. RLS ensures that each user's data is securely isolated during this process. The centralized database can then be used for powerful business analytics and reporting across all tenants, without compromising individual data privacy.
26
24
25
+
---
26
+
27
27
## Policy Enforcement
28
28
29
29
RLS in SQLite Cloud operates based on the following principles:
@@ -40,6 +40,8 @@ To make data accessible to token-authenticated users, you must both enable RLS f
40
40
41
41
Otherwise, they will be blocked from accessing any rows.
42
42
43
+
---
44
+
43
45
## Configuring RLS
44
46
45
47
You can configure RLS policies for your databases through the SQLite Cloud dashboard.
@@ -62,7 +64,31 @@ You can configure RLS policies for your databases through the SQLite Cloud dashb
62
64
The SQL expressions can be any valid SQLite expression that returns a boolean value. You can use built-in SQLite functions, and even custom functions to define your policies.
63
65
</Callout>
64
66
67
+
### User Information Functions
68
+
69
+
To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user:
70
+
71
+
-`auth_userid()`: Returns the `userid` of the current token-authenticated user.
72
+
-`auth_json()`: Returns a JSON object with all the details of the current token-authenticated user, including `user_id`, `name`, `attributes`, `created_at`, and `expires_at`.
73
+
74
+
These functions are particularly useful for creating policies that are based on user attributes.
75
+
76
+
For more information on Access Tokens, see the [Access Tokens documentation](/docs/access-tokens). The API Documentation for the Access Tokens API can be found in the Weblite section in the [Dashboard](https://dashboard.sqlitecloud.io/).
77
+
78
+
### OLD and NEW References
79
+
80
+
Your RLS policies for `INSERT`, `UPDATE`, and `DELETE` operations can reference column values as they are being changed. This is done using the special `OLD.column` and `NEW.column` identifiers. Their availability and meaning depend on the operation being performed:
|`INSERT`| Not available | The value for the new row. |
85
+
|`UPDATE`| The value of the row *before* the update. | The value of the row *after* the update. |
86
+
|`DELETE`| The value of the row being deleted. | Not available |
87
+
88
+
---
89
+
65
90
## Testing RLS
91
+
66
92
<VideoPlayersrc={rlsTest} />
67
93
68
94
To verify that your Row-Level Security (RLS) policies work as expected, you can use the **Test RLS** feature in the dashboard:
@@ -87,26 +113,10 @@ To verify that your Row-Level Security (RLS) policies work as expected, you can
87
113
- By switching back to **Database Studio**, you can see all rows in the table without RLS filters.
88
114
- This allows you to compare the filtered view (via token) with the complete dataset and confirm that your policies are correctly enforced.
89
115
90
-
### User Information Functions
91
116
92
-
To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user:
93
117
94
-
-`auth_userid()`: Returns the `userid` of the current token-authenticated user.
95
-
-`auth_json()`: Returns a JSON object with all the details of the current token-authenticated user, including `user_id`, `name`, `attributes`, `created_at`, and `expires_at`.
96
-
97
-
These functions are particularly useful for creating policies that are based on user attributes.
98
-
99
-
For more information on Access Tokens, see the [Access Tokens documentation](/docs/access-tokens). The API Documentation for the Access Tokens API can be found in the Weblite section in the [Dashboard](https://dashboard.sqlitecloud.io/).
100
118
101
-
### OLD and NEW References
102
-
103
-
Your RLS policies for `INSERT`, `UPDATE`, and `DELETE` operations can reference column values as they are being changed. This is done using the special `OLD.column` and `NEW.column` identifiers. Their availability and meaning depend on the operation being performed:
|`INSERT`| Not available | The value for the new row. |
108
-
|`UPDATE`| The value of the row *before* the update. | The value of the row *after* the update. |
109
-
|`DELETE`| The value of the row being deleted. | Not available |
119
+
---
110
120
111
121
## Example
112
122
@@ -245,7 +255,10 @@ OLD.status <> 'paid'
245
255
**Explanation:**
246
256
This policy uses the `OLD` reference to check the value of the `status` column *before* the update is applied. If the status is already `'paid'`, the condition `OLD.status <> 'paid'` will be false, and the `UPDATE` operation will be denied. This effectively makes paid invoices read-only.
247
257
248
-
### Advanced: RLS and SQLite Sync
258
+
259
+
---
260
+
261
+
## Advanced: RLS and SQLite Sync
249
262
250
263
When using RLS in conjunction with [SQLite Sync](https://github.com/sqliteai/sqlite-sync), it's important to understand how they interact. The Sync protocol applies changes on a column-by-column basis, which can affect how `INSERT` and `UPDATE` policies are evaluated.
Copy file name to clipboardExpand all lines: sqlite-cloud/platform/security.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ To add new users to your cluster, simply click on the **Create User** button.
15
15
16
16
Once a user is successfully created, you can assign one or more roles to them to determine their level of access to the system.
17
17
18
+
---
19
+
18
20
## Roles
19
21
In SQLite Cloud, a role is a set of permissions that allows a user to perform specific actions on a particular resource, such as a database or table. Users can have multiple roles, which determine their access to the system.
20
22
@@ -29,7 +31,7 @@ There are two types of roles in SQLite Cloud:
SQLite Cloud offers a comprehensive system of built-in roles designed to provide essential privileges within a database framework. These roles can be assigned using the [GRANT ROLE](https://docs.sqlitecloud.io/docs/role-commands) command, and custom roles can be created with the [CREATE ROLE](https://docs.sqlitecloud.io/docs/role-commands) command. Privileges represent fundamental operations that can be executed on specific databases or tables and can be granted, revoked, or assigned to specific roles.
Copy file name to clipboardExpand all lines: sqlite-cloud/platform/webhooks.mdx
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,10 @@ import webhooksEdgeFunction from '@docs-website-assets/introduction/video/dashbo
11
11
12
12
**Webhooks** are HTTP callbacks that allow your applications to receive real-time notifications when specific events occur. In the context of SQLite Cloud, webhooks make it easy to build reactive systems by automatically sending notifications when data changes happen within your databases.
13
13
14
+
15
+
---
16
+
17
+
14
18
## Real-Time Notifications for Database Writes
15
19
16
20
@@ -20,7 +24,7 @@ For example, you can configure SQLite Cloud to notify a [webhook.site](https://w
20
24
21
25
<VideoPlayersrc={webhooksUrl} />
22
26
23
-
27
+
---
24
28
25
29
## Change Data Capture
26
30
@@ -64,12 +68,15 @@ This enables seamless integration with logging systems, monitoring dashboards, o
64
68
***data** – The values corresponding to the affected row(s).
65
69
***webhook** – Metadata about the webhook itself, including its unique `id`, target `action` (URL or Edge Function), and configuration `options`.
66
70
71
+
---
72
+
67
73
## Security
68
74
69
75
Upon creation, each webhook is assigned a **secret key** used to verify the authenticity of incoming requests.
0 commit comments