Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sqlite-cloud/connect-cluster.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each

Click "Connect" in the bottom left-hand corner of your dashboard to get your connection string to use with a SQLite Cloud client library.


---


## Connecting with JavaScript
Here's an example of how you can connect to your cluster using the `@sqlitecloud/drivers` JavaScript client library:

Expand All @@ -33,6 +37,8 @@ fetchAlbums().then((albums) => console.log(albums));
// [{ Title: 'For Those About To Rock We Salute You', ... }, ...]
```

---

## Connecting with Python
Install the Python client library:

Expand All @@ -59,6 +65,8 @@ conn.close()
# (1, 'For Those About To Rock We Salute You', 1)
```

---

## Next Steps
- [Creating a database](/docs/create-database)
- [Writing data](/docs/write-data)
14 changes: 12 additions & 2 deletions sqlite-cloud/create-database.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ status: publish
slug: create-database
---

import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
import uploadDb from '@docs-website-assets/introduction/video/dashboard_upload_db.mp4';
import createDb from '@docs-website-assets/introduction/video/dashboard_create_db.mp4';

You can import an existing SQLite databases, or create new databases using the SQLite Cloud UI, API, or client libraries.

---

## Uploading an existing SQLite Database
### Via HTTP API
You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API.
Expand All @@ -26,17 +32,21 @@ To upload a local SQLite database via the SQLite Cloud UI, navigate to the Datab

### Via Dashboard UI
To import a database from the UI, navigate to the Databases tab and click the "Upload Database" button.
![Dashbord Upload Database](@docs-website-assets/introduction/dashboard_upload_db.png)

Select the database file you want to upload, and click "Upload Database". The database will be available in your cluster within a few minutes.

<VideoPlayer src={uploadDb} />

---

## Creating a new database
### From the Dashboard

To create a new database from the SQLite Cloud UI, navigate to the Databases tab and click the "Create Database" button.
![Dashboard Create Database](@docs-website-assets/introduction/dashboard_create_database.png)

The default encoding is set to UTF-8, and the default page size is 4096KB.
<VideoPlayer src={createDb} />


### From the API
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:
Expand Down
21 changes: 14 additions & 7 deletions sqlite-cloud/platform/analyzer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,32 @@ category: platform
status: publish
slug: analyzer
---
import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
import enableAnalyzer from '@docs-website-assets/introduction/video/dashboard_enable_query_analyzer.mp4';
import applyAnalyzer from '@docs-website-assets/introduction/video/dashboard_analyzer_apply_suggestion.mp4';


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.

![Dashboard Empty Analyzer](@docs-website-assets/introduction/dashboard_analyzer_empty.png)
---

## Getting Started

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.
<VideoPlayer src={enableAnalyzer} />


![Dashboard Analyzer Settings](@docs-website-assets/introduction/dashboard_analyzer_settings.png)
----
## Testing the Analyzer
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'`;
<VideoPlayer src={applyAnalyzer} />

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'`;

![Dashboard Analyzer Console](@docs-website-assets/introduction/dashboard_analyzer_console.png)

Once we have executed this query, we can go back to the Analyzer panel and see that it has been successfully analyzed by the **nemtfenosk** node.
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.

![Dashboard Analyzer Query](@docs-website-assets/introduction/dashboard_analyzer_query.png)

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.

![Dashboard Analyzer Suggestion](@docs-website-assets/introduction/dashboard_analyzer_suggest.png)

To apply the recommended index(es), simply select **Apply** and they will be automatically written and distributed in the `Chinook.sqlite` database.
2 changes: 1 addition & 1 deletion sqlite-cloud/platform/apikey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ To create an API key for a user, click on the **Create API KEY** button.

![Dashboard Create APIKEY](@docs-website-assets/introduction/dashboard_create_apikey.png)

The resulting table will display all the API keys associated with each user, along with their name and restrictions.
The resulting table will display all the API keys associated with each user, along with their name.
![Dashboard List APIKEY](@docs-website-assets/introduction/dashboard_list_apikey.png)
27 changes: 14 additions & 13 deletions sqlite-cloud/platform/backups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ status: publish
slug: backups
---

## Overview
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.
import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
import enableDisableBackup from '@docs-website-assets/introduction/video/dashboard_enable_disable_backup.mp4';
import restoreBackup from '@docs-website-assets/introduction/video/dashboard_restore_backup.mp4';

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.

SQLite Cloud creates a full snapshot backup of your data once a day, and stores incremental changes once per second, on commodity object storage.

----

## Features

#### Automated Backups
Expand All @@ -20,21 +25,17 @@ SQLite Cloud creates a full snapshot backup of your data once a day, and stores
- **Easy Restoration Process**: Restoring from a backup automatically overwrites the existing database, seamlessly reverting it to the desired state without additional configuration.
- **Consistency and Reliability**: After restoration, the database functions as it did at the chosen point in time, ensuring operational continuity.

## Getting Started
Setting up and managing backups in SQLite Cloud is designed to be straightforward, allowing you to implement robust data protection strategies effortlessly.

First, navigate to the backups section.

![Backup Empty](@docs-website-assets/introduction/backup_empty.png)
---

Then, click on settings to see a list of your databases. From here, you can enable backups for each database.
![Backup Modal](@docs-website-assets/introduction/backup_modal.png)
## Getting Started
Setting up and managing backups in SQLite Cloud is designed to be straightforward, allowing you to implement robust data protection strategies effortlessly.

Click save, and your database backups will appear below.
![Backup Items](@docs-website-assets/introduction/backup_items.png)
<VideoPlayer src={enableDisableBackup} />

### Restoring from a Backup
---
## Restoring from a Backup

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.

![Restore Backup](@docs-website-assets/introduction/restore_backup.png)
<VideoPlayer src={restoreBackup} />
51 changes: 38 additions & 13 deletions sqlite-cloud/platform/edge-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ category: platform
status: publish
slug: edge-functions
---
import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
import edgeFunctions from '@docs-website-assets/introduction/video/dashboard_edge_functions.mp4';

import Callout from "@commons-components/Information/Callout.astro";

Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance.

Expand All @@ -14,12 +18,16 @@ Edge functions can be called remotely over HTTP or Websockets via API, or trigge

Turning on linearizable reads ensures strong consistency, but may introduce some latency. When eventual consistency is sufficient, we recommend leaving linearizable reads off.

---

## Getting Started
1. Navigate to the Edge Functions page from your dashboard.
2. Under "Development", select "Edge Function", then click the "Create" button.
3. Write and test your function.
1. Select the database you want to access and an API key if necessary
2. When you're finished, click deploy.

Use the **Edge Functions panel** to effortlessly create, deploy, and test Edge Functions directly in the SQLite Cloud dashboard.
The editor allows you to choose the language of your function — **JavaScript**, **TypeScript**, or **SQL** — and connect it to the database of your choice.

Once deployed, the function can be tested immediately in the dashboard or invoked externally through its Function URL.

<VideoPlayer src={edgeFunctions} />

#### Note:
Functions should return a JSON-serializable object with a data field:
Expand All @@ -31,23 +39,37 @@ return {
}
```



<Callout type="note">
Enabling **linearizable reads** guarantees strong consistency but may introduce additional latency.
For most cases, we recommend keeping it disabled to benefit from lower response times.
</Callout>


### Function Details

In the **Details** tab you will find key information about your function, including:

- The **last deployment date and time**
- The **Function URL**, which you can use to call the function from external applications

![Edge Function Details](@docs-website-assets/introduction/dahsboard-edge-function-details.png)



### Authorization
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.
Edge functions that access your SQLite databases must be authorized via API key.

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 }`).
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 }`).

### Execution

Edge functions can be called via HTTP GET and POST methods. You can pass additional values to your edge function in two ways:
- Query parameters: Accessible via `request.params`
- Request body: Accessible via `request.data`

### Testing
You may test the execution of edge functions by clicking the "Test" command.

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.


---

## Guides
### Interacting with your Database
Expand Down Expand Up @@ -83,6 +105,9 @@ You can also add environment variables in the UI by navigating to the "Environme
### Handling Errors
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.


---

## Examples

### Assigning and Notifying a Support Rep on User Sign up
Expand Down
35 changes: 29 additions & 6 deletions sqlite-cloud/platform/offsync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ status: publish
slug: offsync
---

import VideoPlayer from '@commons-components/Video/VideoPlayer.astro';
import enableSync from '@docs-website-assets/introduction/video/dashboard_sqlite_sync_enabling.mp4';
import connectionUrlSync from '@docs-website-assets/introduction/video/dashboard_sync_connection_url.mp4';
import devicesSync from '@docs-website-assets/introduction/video/dashboard_sync_devices.mp4';

import Callout from "@commons-components/Information/Callout.astro";

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.

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.


---

## How It Works

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.
Expand All @@ -22,18 +30,33 @@ OffSync extends standard SQLite tables with built-in support for offline work an

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.


---

## Configuring OffSync

You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
You can enable and manage OffSync for your databases directly from the SQLite Cloud dashboard.
Below are the main steps:

### Enable Tables for Synchronization
From the **Sync Tables** tab, select which tables in your database you want to keep synchronized.
Once enabled, all changes to those tables will automatically sync with connected devices.

<VideoPlayer src={enableSync} />


### Get the Connection String
In the **Configuration** tab, copy the connection string.
Use this in your application to initialize OffSync and connect your local SQLite database with SQLite Cloud.

1. **Navigate to the Databases Page**: From the main dashboard, go to the "Databases" page.
2. **Select the Offsync Column**: In the list of your databases, click on the button in the "Offsync" column for the desired database.
<VideoPlayer src={connectionUrlSync} />

![Dashboard Databases Page](@docs-website-assets/introduction/offsync-1.png)

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.
### Manage Connected Devices
In the **Devices** tab, you can view all devices currently connected to your database.
Here you can check their sync status and remove devices if needed.

![Dashboard Offsync Settings Page](@docs-website-assets/introduction/offsync-2.png)
<VideoPlayer src={devicesSync} />

<Callout type="note" title="Matching Schemas and Tables">
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.
Expand Down
Loading