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
The default encoding is set to UTF-8, and the default page size is 4096KB.
48
+
<VideoPlayersrc={createDb} />
49
+
40
50
41
51
### From the API
42
52
To create a new database or upload an existing database via [Weblite](/docs/weblite), our REST API, you can make a request with the following parameters:
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.
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.
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'`;
26
+
<VideoPlayersrc={applyAnalyzer} />
16
27
17
-
To test the Analyzer, we can go to the `Databases -> Chinook.sqlite -> 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'`;
By selecting **Details** and **Plan**, we can get more in-depth information about the execution of this query over time. However, what we're most interested in is the intelligent recommendation, which can be found by selecting **Suggest**. In the Indexes field, we can find the optimal index to apply to our database, which will speed up all queries on the Track table filtered by the Composer column.
Copy file name to clipboardExpand all lines: sqlite-cloud/platform/backups.mdx
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,16 @@ status: publish
6
6
slug: backups
7
7
---
8
8
9
-
## Overview
10
-
Backups provide a robust solution for mitigating data loss and resolving data corruption issues. Backups are available for databases in all [Pro and Scale](https://www.sqlitecloud.io/pricing) projects.
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.
11
14
12
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.
13
16
17
+
----
18
+
14
19
## Features
15
20
16
21
#### Automated Backups
@@ -20,21 +25,17 @@ SQLite Cloud creates a full snapshot backup of your data once a day, and stores
20
25
-**Easy Restoration Process**: Restoring from a backup automatically overwrites the existing database, seamlessly reverting it to the desired state without additional configuration.
21
26
-**Consistency and Reliability**: After restoration, the database functions as it did at the chosen point in time, ensuring operational continuity.
22
27
23
-
## Getting Started
24
-
Setting up and managing backups in SQLite Cloud is designed to be straightforward, allowing you to implement robust data protection strategies effortlessly.
Setting up and managing backups in SQLite Cloud is designed to be straightforward, allowing you to implement robust data protection strategies effortlessly.
32
33
33
-
Click save, and your database backups will appear below.
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.
Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance.
10
14
@@ -14,12 +18,16 @@ Edge functions can be called remotely over HTTP or Websockets via API, or trigge
14
18
15
19
Turning on linearizable reads ensures strong consistency, but may introduce some latency. When eventual consistency is sufficient, we recommend leaving linearizable reads off.
16
20
21
+
---
22
+
17
23
## Getting Started
18
-
1. Navigate to the Edge Functions page from your dashboard.
19
-
2. Under "Development", select "Edge Function", then click the "Create" button.
20
-
3. Write and test your function.
21
-
1. Select the database you want to access and an API key if necessary
22
-
2. When you're finished, click deploy.
24
+
25
+
Use the **Edge Functions panel** to effortlessly create, deploy, and test Edge Functions directly in the SQLite Cloud dashboard.
26
+
The editor allows you to choose the language of your function — **JavaScript**, **TypeScript**, or **SQL** — and connect it to the database of your choice.
27
+
28
+
Once deployed, the function can be tested immediately in the dashboard or invoked externally through its Function URL.
29
+
30
+
<VideoPlayersrc={edgeFunctions} />
23
31
24
32
#### Note:
25
33
Functions should return a JSON-serializable object with a data field:
@@ -31,23 +39,37 @@ return {
31
39
}
32
40
```
33
41
42
+
43
+
44
+
<Callouttype="note">
45
+
Enabling **linearizable reads** guarantees strong consistency but may introduce additional latency.
46
+
For most cases, we recommend keeping it disabled to benefit from lower response times.
47
+
</Callout>
48
+
49
+
50
+
### Function Details
51
+
52
+
In the **Details** tab you will find key information about your function, including:
53
+
54
+
- The **last deployment date and time**
55
+
- The **Function URL**, which you can use to call the function from external applications
56
+
57
+

58
+
59
+
60
+
34
61
### Authorization
35
-
Edge functions that access your SQLite databases must be authorized via API key. You can automatically authorize an edge function on every call by assigning it an API key via the "API KEY" dropdown.
62
+
Edge functions that access your SQLite databases must be authorized via API key.
36
63
37
-
If no API key is assigned, an API key must be sent in the request url as a query parameter (`?apikey=YOUR_API_KEY`) or as an attribute in the request body (`{ apikey: YOUR_API_KEY }`).
64
+
An API key must be sent in the request url as a query parameter (`?apikey=YOUR_API_KEY`) or as an attribute in the request body (`{ apikey: YOUR_API_KEY }`).
38
65
39
66
### Execution
40
67
41
68
Edge functions can be called via HTTP GET and POST methods. You can pass additional values to your edge function in two ways:
42
69
- Query parameters: Accessible via `request.params`
43
70
- Request body: Accessible via `request.data`
44
71
45
-
### Testing
46
-
You may test the execution of edge functions by clicking the "Test" command.
47
-
48
-
You are not required to supply an API key when testing your edge function in the console. The function will run using the dashboard user privileges.
49
-
50
-
72
+
---
51
73
52
74
## Guides
53
75
### Interacting with your Database
@@ -83,6 +105,9 @@ You can also add environment variables in the UI by navigating to the "Environme
83
105
### Handling Errors
84
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.
85
107
108
+
109
+
---
110
+
86
111
## Examples
87
112
88
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.
12
17
13
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.
14
19
20
+
21
+
---
22
+
15
23
## How It Works
16
24
17
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.
@@ -22,18 +30,33 @@ OffSync extends standard SQLite tables with built-in support for offline work an
22
30
23
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.
24
32
33
+
34
+
---
35
+
25
36
## Configuring OffSync
26
37
27
-
You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
38
+
You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
39
+
Below are the main steps:
40
+
41
+
### Enable Tables for Synchronization
42
+
From the **Sync Tables** tab, select which tables in your database you want to keep synchronized.
43
+
Once enabled, all changes to those tables will automatically sync with connected devices.
44
+
45
+
<VideoPlayersrc={enableSync} />
46
+
47
+
48
+
### Get the Connection String
49
+
In the **Configuration** tab, copy the connection string.
50
+
Use this in your application to initialize OffSync and connect your local SQLite database with SQLite Cloud.
28
51
29
-
1.**Navigate to the Databases Page**: From the main dashboard, go to the "Databases" page.
30
-
2.**Select the Offsync Column**: In the list of your databases, click on the button in the "Offsync" column for the desired database.
3.**Enable Tables for Synchronization**: On the Offsync settings page, you will see a list of all tables in your database. Toggle the switch next to each table you want to enable for synchronization.
55
+
### Manage Connected Devices
56
+
In the **Devices** tab, you can view all devices currently connected to your database.
57
+
Here you can check their sync status and remove devices if needed.
<Callouttype="note"title="Matching Schemas and Tables">
39
62
For OffSync to work correctly, the list of tables configured for synchronization—and their corresponding schemas—must be identical in both your local SQLite database and your SQLite Cloud database.
0 commit comments