From d2cb75b4d52865b257865fb3f396c0b44ac2392a Mon Sep 17 00:00:00 2001 From: Gioele Cantoni Date: Mon, 1 Jul 2024 19:36:56 +0200 Subject: [PATCH 001/185] updated docsearch-action to v3 --- .github/workflows/search.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index ab144b8..61531c0 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: sqlitecloud/docsearch-action@v2 + - uses: sqlitecloud/docsearch-action@v3 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} @@ -21,4 +21,5 @@ jobs: strip-astro-header: true strip-md-titles: true strip-jsx: true - strip-html: true \ No newline at end of file + strip-html: true + path-using-slug: false \ No newline at end of file From 741cf049dcd65fb1d7cc4ca6d8cef4838f4278b5 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 2 Jul 2024 15:12:44 +0200 Subject: [PATCH 002/185] Update search.yml --- .github/workflows/search.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 61531c0..96b127e 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -22,4 +22,4 @@ jobs: strip-md-titles: true strip-jsx: true strip-html: true - path-using-slug: false \ No newline at end of file + path-using-slug: true From 6aa3809e78303103a8c4b8fd30c8195114ee06b0 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 2 Jul 2024 15:15:02 +0200 Subject: [PATCH 003/185] Update search.yml --- .github/workflows/search.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 96b127e..c326cbf 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -22,4 +22,4 @@ jobs: strip-md-titles: true strip-jsx: true strip-html: true - path-using-slug: true + path-using-slug: false From d4cd8d52dad4c086743b172a2668d5c96d6f8e79 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Wed, 3 Jul 2024 10:07:31 -0700 Subject: [PATCH 004/185] init quick start next --- sqlite-cloud/quick-start-next.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sqlite-cloud/quick-start-next.mdx diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx new file mode 100644 index 0000000..e32c6bd --- /dev/null +++ b/sqlite-cloud/quick-start-next.mdx @@ -0,0 +1,9 @@ +--- +title: Next Quick Start Guide +description: Get started with SQLite Cloud using Next.js. +category: getting-started +status: publish +slug: quick-start-next +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Next.js by building a simple application that connects to and reads from a SQLite Cloud database. \ No newline at end of file From 980c488138667b20503e890599947d208397ff3c Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Wed, 3 Jul 2024 10:12:43 -0700 Subject: [PATCH 005/185] add next to nav --- sqlite-cloud/_nav.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 424fc65..b787f5b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -11,6 +11,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "Quick Start Guides", type: "inner", level: 0 }, { title: "React", filePath: "sqlite-cloud/quick-start-react", type: "inner", level: 1 }, { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, From 91b85f99d0d781007089150e190bd04ee40022ba Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 12:26:19 -0700 Subject: [PATCH 006/185] update --- sqlite-cloud/_nav.ts | 3 ++ sqlite-cloud/quick-start-django.mdx | 3 +- sqlite-cloud/quick-start-node.mdx | 59 +++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 sqlite-cloud/quick-start-node.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 8fc25c0..044accd 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -9,8 +9,11 @@ const sidebarNav: SidebarNavStruct = [ { title: "Creating a database", filePath: "sqlite-cloud/create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "sqlite-cloud/write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "sqlite-cloud/quick-start-react", type: "inner", level: 1 }, { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quick-start-django.mdx index 63a7e84..5c4beaf 100644 --- a/sqlite-cloud/quick-start-django.mdx +++ b/sqlite-cloud/quick-start-django.mdx @@ -2,7 +2,8 @@ title: Django Quick Start Guide description: Get started with SQLite Cloud using Django. category: getting-started -status: draft +status: publish +slug: quick-start-django --- In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database, and returns the result to a lightweight client. diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx new file mode 100644 index 0000000..38bd42a --- /dev/null +++ b/sqlite-cloud/quick-start-node.mdx @@ -0,0 +1,59 @@ +--- +title: Node.js Quick Start Guide +description: Get started with SQLite Cloud using Node.js and Express. +category: getting-started +status: publish +slug: quick-start-node +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Node.js by building a simple web server that connects to and reads from a SQLite Cloud database, then serves that data to the client. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. +2. **Create a Node.js app** + - Navigate to your target directory and run the following command to initialize your Node.js app and install the necessary depedencies: +```bash +npm init +``` + - After creating your project, install the SQLite Cloud SDK: +```bash +npm install express @sqlitecloud/drivers --save +``` + - Create a file named `index.js` in the root directory of your project. + +3. **Query data** + - Grab a connection string by clicking on a node in your dashboard. + - Paste the following into your `index.js` file: + ```javascript +const express = require('express'); +const { Database } = require('@sqlitecloud/drivers'); + +const app = express(); +const db = new Database(''); + +app.get('/albums', async (req, res) => { + const result = await db.sql` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`; + res.json(result); +}); + +app.listen(3000, () => { + console.log('Server running on port 3000'); +}); +``` +5. **Run your app** +```bash +node app.js +``` +6. **View your web server response** + - Open your browser and navigate to `http://localhost:3000/albums` to see your app in action. + +And that's it! You've successfully built a Node.js app that reads and serves data from a SQLite Cloud database. From 164c212f777ffa2202cf282ffac7d0c686f42ad4 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 12:27:51 -0700 Subject: [PATCH 007/185] update spacing in node docs --- sqlite-cloud/quick-start-node.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 38bd42a..35c027e 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -35,14 +35,14 @@ const app = express(); const db = new Database(''); app.get('/albums', async (req, res) => { - const result = await db.sql` - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; - res.json(result); + const result = await db.sql` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`; + res.json(result); }); app.listen(3000, () => { From 35f711aa03778ffd2987644fd040635e487bf820 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 12:29:30 -0700 Subject: [PATCH 008/185] update padding --- sqlite-cloud/quick-start-node.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 35c027e..ccd4966 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -27,7 +27,8 @@ npm install express @sqlitecloud/drivers --save 3. **Query data** - Grab a connection string by clicking on a node in your dashboard. - Paste the following into your `index.js` file: - ```javascript + +```javascript const express = require('express'); const { Database } = require('@sqlitecloud/drivers'); From a8b794d9a8bfc54f3087f0c5e6ea53d1c67de78d Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 12:32:50 -0700 Subject: [PATCH 009/185] improve write data --- sqlite-cloud/_nav.ts | 3 +-- sqlite-cloud/write-data.mdx | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 044accd..6a92063 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -9,12 +9,11 @@ const sidebarNav: SidebarNavStruct = [ { title: "Creating a database", filePath: "sqlite-cloud/create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "sqlite-cloud/write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "sqlite-cloud/quick-start-react", type: "inner", level: 1 }, { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 64d5acf..3488ae2 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -7,6 +7,21 @@ status: publish After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. +## Upload an existing SQLite Database +You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API. + +To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=.sqlite` endpoint. - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=.sqlite.cloud:8090/v2/weblite/sql' \ -H 'accept: application/json' \ -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ - -d '' + -d '' ``` ## Writing data with client libraries @@ -60,3 +63,4 @@ const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_name, sc insertData().then((res) => console.log(res)); // "OK" ``` + From 2a8268ac667ec50280702594299a0a635226ff89 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 12:34:29 -0700 Subject: [PATCH 010/185] remove duplicate entry --- sqlite-cloud/_nav.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 6a92063..9c396ed 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -127,7 +127,6 @@ const sidebarNav: SidebarNavStruct = [ { title: "JavaScript", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/js/getting-started", level: 1 }, - { title: 'React Quick Start', type: "inner", filePath: "sqlite-cloud/quick-start-react", level: 1 }, { title: "Python", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, From cdce3775a8c7c2db23139a8d4a002a161c723687 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 4 Jul 2024 14:27:46 -0700 Subject: [PATCH 011/185] typos and grammar --- sqlite-cloud/connect-cluster.mdx | 2 +- sqlite-cloud/create-database.mdx | 2 +- sqlite-cloud/index.mdx | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index ac44370..518a5b2 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -7,7 +7,7 @@ status: publish SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each cluster comes with a multi-region load balancer that routes traffic to the nearest appropriate node. -For this reason, we strongly recommend connecting to your cluster via your project connection string. To retrive your project connection string, navigate to the **Nodes** page and click on any node. +For this reason, we strongly recommend connecting to your cluster via your project connection string. To retrieve your project connection string, navigate to the **Nodes** page and click on any node. {/* ![Project connection string modal](@docs-website-assets/connect-cluster-1.png) */} Copy the connection string and use it with a client library to connect to your cluster. diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index fbf69c6..9d36fb3 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -5,7 +5,7 @@ category: getting-started status: publish --- -Create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries. +SQLite Cloud allows you to import existing SQLite Databases, or create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries. ## Importing an existing SQLite database SQLite Cloud allows you to import existing SQLite databases into the platform. diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 733e36c..1552c7c 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -6,11 +6,11 @@ status: publish --- ## Overview -**SQLite Cloud** is a distributed relational database system built on top of the SQLite database engine. +**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. -It has been designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. +It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. -**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the [most popular programming](../docs/sdk/) languages or its REST API. +**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. --- @@ -18,14 +18,14 @@ It has been designed from the ground up to ensure the strong consistency of your **SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. -**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees to be strongly consistent across all the cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. +**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. ## Features -SQLite Cloud also provides a suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and syncronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In developmpent**). +SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. +* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). +* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). * **[Webhooks](/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/edge_functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. * **[Pub/Sub](/pub_sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. From 3834d0e25c023dbbe01f3163068de5f7eab014d4 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:26:41 +0200 Subject: [PATCH 012/185] update nav --- sqlite-cloud/_nav.ts | 22 +++++++++---------- sqlite-cloud/connect-cluster.mdx | 1 + sqlite-cloud/create-database.mdx | 1 + sqlite-cloud/quick-start-react-native.mdx | 3 ++- sqlite-cloud/quick-start-react.mdx | 1 + sqlite-cloud/sdks/c/getting-started.mdx | 1 + .../{getting-started.mdx => introduction.mdx} | 1 + .../{getting-started.mdx => introduction.mdx} | 1 + sqlite-cloud/sdks/js/modules.md | 1 + .../{getting-started.mdx => introduction.mdx} | 1 + sqlite-cloud/sdks/php/methods.mdx | 1 + sqlite-cloud/write-data.mdx | 1 + 12 files changed, 23 insertions(+), 12 deletions(-) rename sqlite-cloud/sdks/go/{getting-started.mdx => introduction.mdx} (99%) rename sqlite-cloud/sdks/js/{getting-started.mdx => introduction.mdx} (99%) rename sqlite-cloud/sdks/php/{getting-started.mdx => introduction.mdx} (99%) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 9c396ed..a86ad1d 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -5,14 +5,14 @@ const sidebarNav: SidebarNavStruct = [ { title: "Getting Started", type: "secondary", icon: "docs-star" }, { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav { title: "Fundamentals", type: "inner", level: 0 }, - { title: "Connecting", filePath: "sqlite-cloud/connect-cluster", type: "inner", level: 1 }, - { title: "Creating a database", filePath: "sqlite-cloud/create-database", type: "inner", level: 1 }, - { title: "Writing data", filePath: "sqlite-cloud/write-data", type: "inner", level: 1 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "sqlite-cloud/quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + // { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + // { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, @@ -29,7 +29,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "SDKs", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, - { title: "Introduction", type: "inner", filePath: "sqlite-cloud/sdks/c/getting-started", level: 1, }, + { title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, }, { title: 'Basic APIs', type: "inner", level: 1 }, { filePath: 'sqlite-cloud/sdks/c/SQCloudConnect', type: "inner", level: 2 }, { filePath: 'sqlite-cloud/sdks/c/SQCloudConnectWithString', type: "inner", level: 2 }, @@ -126,17 +126,17 @@ const sidebarNav: SidebarNavStruct = [ { filePath: 'sqlite-cloud/sdks/c/SQCloudDownloadDatabase', type: "inner", level: 2 }, { title: "JavaScript", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/js/getting-started", level: 1 }, + { title: 'Introduction', type: "inner", filePath: "sdk-js-introduction", level: 1 }, { title: "Python", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, { title: "Go", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/go/getting-started", level: 1 }, + { title: 'Introduction', type: "inner", filePath: "sdk-go-introduction", level: 1 }, { title: "PHP", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/php/getting-started", level: 1 }, - { title: "Methods", filePath: "sqlite-cloud/sdks/php/methods", type: "inner", level: 1 }, + { title: 'Introduction', type: "inner", filePath: "sdk-php-introduction", level: 1 }, + { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, { title: "Reference", type: "secondary", icon: "docs-ref" }, { title: "Server-side Commands", type: "inner", level: 0 }, diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 518a5b2..29ed3b8 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -3,6 +3,7 @@ title: Connecting to a Cluster description: Learn how to connect to a cluster in SQLite Cloud. category: getting-started status: publish +slug: connect-cluster --- SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each cluster comes with a multi-region load balancer that routes traffic to the nearest appropriate node. diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index 9d36fb3..d2d7167 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -3,6 +3,7 @@ title: Creating a Database description: Learn how to import a database into SQLite Cloud. category: getting-started status: publish +slug: create-database --- SQLite Cloud allows you to import existing SQLite Databases, or create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries. diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 4436d3b..48e275f 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -2,7 +2,8 @@ title: React Native Quick Start Guide description: Get started with SQLite Cloud using React Native. category: getting-started -status: publish +status: draft +slug: quick-start-react-native --- In this quickstart, we will show you how to get started with SQLite Cloud and React Native by building a simple application that connects to and reads from a SQLite Cloud database. diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index ce6ef72..f40d014 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -3,6 +3,7 @@ title: React Quick Start Guide description: Get started with SQLite Cloud using React. category: getting-started status: publish +slug: quick-start-react --- In this quickstart, we will show you how to get started with SQLite Cloud and React by building a simple application that connects to and reads from a SQLite Cloud database. diff --git a/sqlite-cloud/sdks/c/getting-started.mdx b/sqlite-cloud/sdks/c/getting-started.mdx index fa14c1b..af48f01 100644 --- a/sqlite-cloud/sdks/c/getting-started.mdx +++ b/sqlite-cloud/sdks/c/getting-started.mdx @@ -3,6 +3,7 @@ title: C description: SQCloud C Interface category: sdks status: publish +slug: sdk-c-introduction --- SQCloud is the C application programmer's interface to SQLite Cloud. SQCloud is a set of library functions that allow client programs to pass queries and SQL commands to the SQLite Cloud backend server and to receive the results of these queries. In addition to the standard SQLite statements, several other [commands](/docs/commands) are supported. diff --git a/sqlite-cloud/sdks/go/getting-started.mdx b/sqlite-cloud/sdks/go/introduction.mdx similarity index 99% rename from sqlite-cloud/sdks/go/getting-started.mdx rename to sqlite-cloud/sdks/go/introduction.mdx index 096d0c5..a6d96f7 100644 --- a/sqlite-cloud/sdks/go/getting-started.mdx +++ b/sqlite-cloud/sdks/go/introduction.mdx @@ -4,6 +4,7 @@ description: Here's the how gettting started to use the SQLite Cloud in your Go customClass: sdk-doc badge-doc go-doc category: sdks status: publish +slug: sdk-go-introduction --- ## Use the SQLite Cloud SDK in your Go code diff --git a/sqlite-cloud/sdks/js/getting-started.mdx b/sqlite-cloud/sdks/js/introduction.mdx similarity index 99% rename from sqlite-cloud/sdks/js/getting-started.mdx rename to sqlite-cloud/sdks/js/introduction.mdx index ead3f32..170e23a 100644 --- a/sqlite-cloud/sdks/js/getting-started.mdx +++ b/sqlite-cloud/sdks/js/introduction.mdx @@ -4,6 +4,7 @@ description: SQLite Cloud Javascript SDK customClass: sdk-doc badge-doc js-doc category: sdks status: publish +slug: sdk-js-introduction --- [![npm package][npm-img]][npm-url] diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 23c8f07..5d85d69 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -4,6 +4,7 @@ description: SQLite Cloud Javascript SDK customClass: sdk-doc badge-doc js-doc category: sdks status: publish +slug: sdk-js-modules --- ## Table of contents diff --git a/sqlite-cloud/sdks/php/getting-started.mdx b/sqlite-cloud/sdks/php/introduction.mdx similarity index 99% rename from sqlite-cloud/sdks/php/getting-started.mdx rename to sqlite-cloud/sdks/php/introduction.mdx index bdf9084..2c476fd 100644 --- a/sqlite-cloud/sdks/php/getting-started.mdx +++ b/sqlite-cloud/sdks/php/introduction.mdx @@ -4,6 +4,7 @@ description: Get started with SQLite Cloud using PHP. customClass: sdk-doc badge-doc php-doc category: sdks status: publish +slug: sdk-php-introduction --- diff --git a/sqlite-cloud/sdks/php/methods.mdx b/sqlite-cloud/sdks/php/methods.mdx index 6aa8c79..18b3c47 100644 --- a/sqlite-cloud/sdks/php/methods.mdx +++ b/sqlite-cloud/sdks/php/methods.mdx @@ -4,6 +4,7 @@ description: Methods available in the SQLite Cloud PHP SDK. customClass: sdk-doc badge-doc php-doc category: sdks status: publish +slug: sdk-php-methods --- diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 3488ae2..32bd329 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -3,6 +3,7 @@ title: Writing data to your database description: Learn how to write data to your SQLite Cloud cluster. category: getting-started status: publish +slug: write-data --- After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. From 800f601d13db71bc98d5a7e163f97cbd966bc3f6 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:32:21 +0200 Subject: [PATCH 013/185] fix pub sub dos --- sqlite-cloud/platform/pub-sub.mdx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/platform/pub-sub.mdx b/sqlite-cloud/platform/pub-sub.mdx index c1de946..71744c8 100644 --- a/sqlite-cloud/platform/pub-sub.mdx +++ b/sqlite-cloud/platform/pub-sub.mdx @@ -47,7 +47,7 @@ JSON is used to deliver payload to all listening clients. JSON format depends on sender: "UUID", channel: "tablename", type: "TABLE", - pk: ["id", col1"] // array of primary key name(s) + pk: ["id", "col1"], // array of primary key name(s) payload: [ // array of operations that affect table name { type: "INSERT", @@ -57,17 +57,16 @@ JSON is used to deliver payload to all listening clients. JSON format depends on }, { type: "DELETE", - pv: [13] // primary key value (s) in the same order as the pk array + pv: [13], // primary key value (s) in the same order as the pk array }, { type: "UPDATE", id: 15, // new value col1: "newvalue", - col2: 0.0 + col2: 0.0, // if primary key is updated during this update then add it to: // UPDATE TABLE SET col1='newvalue', col2=0.0, id = 15 WHERE id=14 pv: [14] // primary key value (s) set prior to this UPDATE operation - ] } ] } From 8fe70a4a626799ebc5f077cdc2b98b20b35dbc68 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:40:25 +0200 Subject: [PATCH 014/185] update --- sqlite-cloud/connect-cluster.mdx | 3 +-- sqlite-cloud/reference/cli-commands.mdx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 29ed3b8..52f6b4b 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -63,5 +63,4 @@ conn.close() ``` ## Next Steps -- [Importing databases](#) -- [Writing data](#) +- [Writing data](write-data) diff --git a/sqlite-cloud/reference/cli-commands.mdx b/sqlite-cloud/reference/cli-commands.mdx index cd92e44..fa65182 100644 --- a/sqlite-cloud/reference/cli-commands.mdx +++ b/sqlite-cloud/reference/cli-commands.mdx @@ -12,7 +12,7 @@ It's worth noting that there are two versions of the CLI available: one written * Binaries can be downloaded from [GitHub](https://github.com/sqlitecloud/sdk/releases). * C source code can be downloaded from the [C SDK repo](https://github.com/sqlitecloud/sdk/tree/master/C). -* GO source code can be downlaoded from the [GO SDK repo](https://github.com/sqlitecloud/sdk/tree/master/GO). +* GO source code can be downlaoded from the [GO SDK repo](https://github.com/sqlitecloud/sqlitecloud-go). The C cli (sqlitecloud-cli) is available for Linux (x86) and macOS (Intel and ARM). From ef46ea09e83170115c3f329e1df81e9ad975f16c Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:42:05 +0200 Subject: [PATCH 015/185] update --- sqlite-cloud/connect-cluster.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 52f6b4b..8a75622 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -63,4 +63,4 @@ conn.close() ``` ## Next Steps -- [Writing data](write-data) +- [Writing data](/docs/write-data) From 4c3c2ffe7b88c9ee4ffde5e03748866fdfb48ae4 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:47:43 +0200 Subject: [PATCH 016/185] update liks --- sqlite-cloud/index.mdx | 10 +++++----- sqlite-cloud/platform/edge-functions.mdx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 1552c7c..4ed19f0 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -26,9 +26,9 @@ In a distributed database system, where data is distributed across multiple node SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. * **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). * **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[Webhooks](/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. -* **[Edge Functions](/edge_functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. -* **[Pub/Sub](/pub_sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **[Weblite](/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. -* **[Query Analyzer](/query_analyzer)**: Receive optimization recommendations for your queries to improve performance. +* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. +* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. +* **[Pub/Sub](/docs/pub_sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. +* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. * **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index 6278789..b49bbdc 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -10,7 +10,7 @@ Edge Functions are server-side functions that run directly within your database You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported. -Edge functions can be called remotely over HTTP or Websockets via API, or triggered by database events via SQLite Cloud [Webhooks](https://docs.sqlitecloud.io/docs/introduction/webhooks). Each function runs in an isolated environment using the Bun runtime. +Edge functions can be called remotely over HTTP or Websockets via API, or triggered by database events via SQLite Cloud [Webhooks](https://docs.sqlitecloud.io/docs/webhooks). Each function runs in an isolated environment using the Bun runtime. Turning on linearizable reads ensures strong consistency, but may introduce some latency. When eventual consistency is sufficient, we recommend leaving linearizable reads off. From 99909eb61a35016e3a9cfd57721b4ba2700ac558 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:51:12 +0200 Subject: [PATCH 017/185] fix more links --- sqlite-cloud/index.mdx | 2 +- sqlite-cloud/platform/edge-functions.mdx | 2 +- sqlite-cloud/platform/security.mdx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 4ed19f0..b2f3012 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -28,7 +28,7 @@ SQLite Cloud provides a comprehensive suite of tools for building realtime, loca * **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). * **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. -* **[Pub/Sub](/docs/pub_sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. +* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. * **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. * **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. * **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index b49bbdc..080c51d 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -41,7 +41,7 @@ return { } ``` -Select the database you would like to access from the "Database" dropdown, or select the database you want to use in your SQL query with the [USE command](https://docs.sqlitecloud.io/docs/commands/use-database). +Select the database you would like to access from the "Database" dropdown, or select the database you want to use in your SQL query with the [USE command](https://docs.sqlitecloud.io/docs/database-commands). ```js const customers = await connection.sql`USE DATABASE chinook.sqlite; SELECT * FROM customers;`; diff --git a/sqlite-cloud/platform/security.mdx b/sqlite-cloud/platform/security.mdx index 22605d4..849197d 100644 --- a/sqlite-cloud/platform/security.mdx +++ b/sqlite-cloud/platform/security.mdx @@ -32,7 +32,7 @@ There are two types of roles in SQLite Cloud: ## Built-in roles import Callout from "@commons-components/Information/Callout.astro"; -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/commands/grant-role) command, and custom roles can be created with the [CREATE ROLE](https://docs.sqlitecloud.io/docs/commands/create-role) command. Privileges represent fundamental operations that can be executed on specific databases or tables and can be granted, revoked, or assigned to specific roles. +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/commands/create-role) command. Privileges represent fundamental operations that can be executed on specific databases or tables and can be granted, revoked, or assigned to specific roles. Here is an overview of the built-in roles: @@ -58,7 +58,7 @@ Here is an overview of the built-in roles: -To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/commands/create-role), [GRANT ROLE](/docs/commands/grant-role), [GRANT PRIVILEGE](https://docs.sqlitecloud.io/docs/commands/grant-privilege) and [SET PRIVILEGE](https://docs.sqlitecloud.io/docs/commands/set-privilege) commands, as well as during the [CREATE USER](https://docs.sqlitecloud.io/docs/commands/create-user) command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. +To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/commands/create-role), [GRANT ROLE](/docs/role-commands), [GRANT PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) and [SET PRIVILEGE](https://docs.sqlitecloud.io/docs/commands/set-privilege) commands, as well as during the [CREATE USER](https://docs.sqlitecloud.io/docs/commands/create-user) command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. ```bash From c3252b46c3e429ced68ebc52585e66a0f6e0391f Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:53:38 +0200 Subject: [PATCH 018/185] fix more links --- sqlite-cloud/platform/security.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/platform/security.mdx b/sqlite-cloud/platform/security.mdx index 849197d..5677f15 100644 --- a/sqlite-cloud/platform/security.mdx +++ b/sqlite-cloud/platform/security.mdx @@ -32,7 +32,7 @@ There are two types of roles in SQLite Cloud: ## Built-in roles import Callout from "@commons-components/Information/Callout.astro"; -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/commands/create-role) command. Privileges represent fundamental operations that can be executed on specific databases or tables and can be granted, revoked, or assigned to specific roles. +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. Here is an overview of the built-in roles: @@ -58,7 +58,7 @@ Here is an overview of the built-in roles: -To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/commands/create-role), [GRANT ROLE](/docs/role-commands), [GRANT PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) and [SET PRIVILEGE](https://docs.sqlitecloud.io/docs/commands/set-privilege) commands, as well as during the [CREATE USER](https://docs.sqlitecloud.io/docs/commands/create-user) command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. +To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/role-commands), [GRANT ROLE](/docs/role-commands), [GRANT PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) and [SET PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) commands, as well as during the [CREATE USER](https://docs.sqlitecloud.io/docs/user-commands) command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. ```bash @@ -98,7 +98,7 @@ In a role-based access control system, a privilege represents a specific action It defines what a user can or cannot do, such as reading, writing, or managing certain resources like tables, databases, or settings. Essentially, a privilege is a **right** or **ability** granted to a user or role, specifying their level of access and control over the system's resources. -A privilege can be [granted](https://docs.sqlitecloud.io/docs/commands/grant-privilege), [revoked](https://docs.sqlitecloud.io/docs/commands/revoke-privilege) and [assigned](https://docs.sqlitecloud.io/docs/commands/set-privilege) to a given role. +A privilege can be [granted](https://docs.sqlitecloud.io/docs/privilege-commands), [revoked](https://docs.sqlitecloud.io/docs/privilege-commands) and [assigned](https://docs.sqlitecloud.io/docs/privilege-commands) to a given role. A role can contains any combination of privileges. ```bash @@ -162,7 +162,7 @@ The IP Restrictions table will display all current IP restrictions for the selec ## API KEYs -API KEYs can be used as an alternative authentication mechanism. Authentication through API keys ensures the same privileges as the user to which they are associated. API KEYs are recommended for all server-to-server authentication cases and are necessary for using the [REST APIs](/docs/introduction/api) and the [SDK](/docs/sdk) that uses the WebSocket APIs. +API KEYs can be used as an alternative authentication mechanism. Authentication through API keys ensures the same privileges as the user to which they are associated. API KEYs are recommended for all server-to-server authentication cases and are necessary for using the REST APIs and the SDKs that uses the WebSocket APIs. To create an API key for a user, click on the **Create API KEY** button. From 190e3ee0cea372a38bedf848abd1d61ed82f3837 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 15:56:18 +0200 Subject: [PATCH 019/185] fixing links --- sqlite-cloud/sdks/c/SQCloudArrayCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobRead.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConfig.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConnect.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudDisconnect.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudError.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudExec.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudExecArray.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudResultDouble.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultDump.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultFloat.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultInt32.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultInt64.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx | 3 +-- sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudUUID.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMBind.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMChanges.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMColumn.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMCompile.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMResult.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMStep.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx | 2 +- sqlite-cloud/sdks/go/introduction.mdx | 6 +++--- sqlite-cloud/sdks/js/introduction.mdx | 2 +- 59 files changed, 92 insertions(+), 93 deletions(-) diff --git a/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx b/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx index 4e27ac2..d0b7c17 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudArrayCount (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the number of items in the SQCloudResult array. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the number of items in the SQCloudResult array. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx index 8b4db0b..c71b8b2 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx @@ -10,11 +10,11 @@ double SQCloudArrayDoubleValue (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a double value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a double value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) ### Return value An `double` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx index 9ddc0f8..6f60f78 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx @@ -10,11 +10,11 @@ float SQCloudArrayFloatValue (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a float value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a float value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) ### Return value A `float` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx b/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx index 39fb064..486c607 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx @@ -10,11 +10,11 @@ int32_t SQCloudArrayInt32Value (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int32 value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int32 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) ### Return value An `int32_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx b/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx index fee7569..cf809f0 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx @@ -10,11 +10,11 @@ int64_t SQCloudArrayInt64Value (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int64 value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int64 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) ### Return value An `int64_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx index e7d3de6..174e57c 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx @@ -10,11 +10,11 @@ char *SQCloudArrayValue (SQCloudResult *result, uint32_t index, uint32_t *len); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a pointer and a length for an array value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a pointer and a length for an array value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) * **len**: On output the length of the returned buffer ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx b/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx index 15c0f37..849bc6e 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx @@ -10,11 +10,11 @@ SQCLOUD_VALUE_TYPE SQCloudArrayValueType (SQCloudResult *result, uint32_t index) ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the type of each array item. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the type of each array item. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdk/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) ### Return value An `int` represented by the SQCLOUD_VALUE_TYPE enum type: diff --git a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx index c6d6db4..9c318cd 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx @@ -16,7 +16,7 @@ The incremental blob I/O routines can only read or overwriting existing blob con This function resembles the [sqlite3_blob_bytes](https://www.sqlite.org/c3ref/blob_bytes.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdk/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) ### Return value An `int` value with the size in bytes of the BLOB. diff --git a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx index bd237f8..0244506 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx @@ -13,7 +13,7 @@ bool SQCloudBlobClose (SQCloudBlob *blob); This function closes an open BLOB handle. The BLOB handle is closed unconditionally. Even if this routine returns an error code, the handle is still closed. This function resembles the [sqlite3_blob_close](https://www.sqlite.org/c3ref/blob_close.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdk/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) ### Return value `true` if operation succed, otherwise `false` diff --git a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx index c62d397..e373e3d 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx @@ -25,7 +25,7 @@ This function fails if any of the following conditions are true: This function resembles the [sqlite3_blob_open](https://www.sqlite.org/c3ref/blob_open.html) SQLite API. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **dbname**: symbolic name of the database (usually `main`, if NULL `main` is used) * **tablename**: table name that contains the BLOB column * **colname**: name of the BLOB column diff --git a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx index a25a270..91f6195 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx @@ -15,7 +15,7 @@ This function is used to move an existing BLOB handle so that it points to a dif This function resembles the [sqlite3_blob_reopen](https://www.sqlite.org/c3ref/blob_reopen.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdk/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) * **rowid**: rowid of the BLOB to open diff --git a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx index 48b2854..3facf99 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx @@ -15,7 +15,7 @@ The **SQCloudBlobRead** function is used to read data from an open BLOB handle i This function resembles the [sqlite3_blob_read](https://www.sqlite.org/c3ref/blob_read.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdk/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) * **buffer**: an user-supplied pre-allocated buffer * **blen**: the length of the input buffer * **offset**: the offset value set to where to start the read operation diff --git a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx index 9e77167..745f0e5 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx @@ -16,7 +16,7 @@ The **SQCloudBlobWrite** function is used to write data into an open BLOB handle This function resembles the [sqlite3_blob_write](https://www.sqlite.org/c3ref/blob_write.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdk/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) * **buffer**: an user-supplied pre-allocated buffer * **blen**: the length of the input buffer * **offset**: the offset value set to where to start the write operation diff --git a/sqlite-cloud/sdks/c/SQCloudConfig.mdx b/sqlite-cloud/sdks/c/SQCloudConfig.mdx index bffb389..01b836b 100644 --- a/sqlite-cloud/sdks/c/SQCloudConfig.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConfig.mdx @@ -7,7 +7,7 @@ status: publish ### Description -The **SQCloudConfig** struct is used in the [SQCloudConnect](/docs/sdk/c/sqcloudconnect) and in the [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) functions to set connection specific configuration parameters. +The **SQCloudConfig** struct is used in the [SQCloudConnect](/docs/sdks/c/sqcloudconnect) and in the [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) functions to set connection specific configuration parameters. ### SQCloudConfig diff --git a/sqlite-cloud/sdks/c/SQCloudConnect.mdx b/sqlite-cloud/sdks/c/SQCloudConnect.mdx index 3839466..8dd2b9f 100644 --- a/sqlite-cloud/sdks/c/SQCloudConnect.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConnect.mdx @@ -15,7 +15,7 @@ Initiate a new connection to a database node specified by hostname and port. Thi ### Parameters * **hostname**: a NULL terminated string that contains host name or host ip address * **port**: database server port (you can use the `SQCLOUD_DEFAULT_PORT` macro) -* **config**: a pointer to a [SQCloudConfig struct](/docs/sdk/c/sqcloudconfig) (cannot be NULL) +* **config**: a pointer to a [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig) (cannot be NULL) ### Return value A pointer to an opaque **SQCloudConnection** struct. diff --git a/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx b/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx index a64c76d..48e0f43 100644 --- a/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx @@ -16,7 +16,7 @@ Initiate a new connection to a database node specified by a connection string. T String `s` must be an URL encoded string with the following format: `sqlitecloud://user:pass@host.com:port/dbname?timeout=10&key2=value2&key3=value3`. -An easy way to obtain a valid connection string is to click on the node address in the [Dashboard Nodes](/docs/introduction/nodes) section. A valid connection string will be copied in your clipboard. +An easy way to obtain a valid connection string is to click on the node address in the [Dashboard Nodes](/docs/scaling) section. A valid connection string will be copied in your clipboard. Key(s) can be: @@ -34,11 +34,11 @@ Key(s) can be: * client_certificate * client_certificate_key -These key(s) are equivalent to the fields specified in the [SQCloudConfig struct](/docs/sdk/c/sqcloudconfig). +These key(s) are equivalent to the fields specified in the [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig). ### Parameters * **s**: an URL encoded NULL terminated string that contains connection info -* **pconfig**: a pointer to a [SQCloudConfig struct](/docs/sdk/c/sqcloudconfig) (can be NULL) used to override configurations found in the connection string +* **pconfig**: a pointer to a [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig) (can be NULL) used to override configurations found in the connection string ### Return value A pointer to an opaque **SQCloudConnection** struct. diff --git a/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx b/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx index 83f8042..1a3958b 100644 --- a/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx +++ b/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx @@ -13,7 +13,7 @@ void SQCloudDisconnect (SQCloudConnection *connection); Closes the connection to the server. Also frees memory used by the SQCloudConnection object. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) ### Return value Nothing. diff --git a/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx b/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx index 8f6f321..77760b1 100644 --- a/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx +++ b/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx @@ -14,7 +14,7 @@ bool SQCloudDownloadDatabase (SQCloudConnection *connection, const char *dbname, Initiate an SQLite database download from an already connected SQLite Cloud node. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **dbname**: the name of the database to download * **xdata**: a pointer to an opaque datatype that will be passed as-is to the callback * **xcallback**: callback that will be automatically called to read from the input database file diff --git a/sqlite-cloud/sdks/c/SQCloudError.mdx b/sqlite-cloud/sdks/c/SQCloudError.mdx index ebad0de..b6e2cea 100644 --- a/sqlite-cloud/sdks/c/SQCloudError.mdx +++ b/sqlite-cloud/sdks/c/SQCloudError.mdx @@ -20,7 +20,7 @@ These functions resemble the [sqlite3_error_*](https://www.sqlite.org/c3ref/errc ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) ### Return value * **SQLiteIsError** returns `true` if the most recent API call failed. diff --git a/sqlite-cloud/sdks/c/SQCloudExec.mdx b/sqlite-cloud/sdks/c/SQCloudExec.mdx index a76653c..048ae76 100644 --- a/sqlite-cloud/sdks/c/SQCloudExec.mdx +++ b/sqlite-cloud/sdks/c/SQCloudExec.mdx @@ -13,11 +13,11 @@ SQCloudResult *SQCloudExec (SQCloudConnection *connection, const char *command); Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **command**: a NULL terminated string with the command to execute (multiple commands can be sent if separated by the semicolon character) ### Return value -A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdk/c/sqcloudresultfree) +A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdks/c/sqcloudresultfree) ### Example ```c diff --git a/sqlite-cloud/sdks/c/SQCloudExecArray.mdx b/sqlite-cloud/sdks/c/SQCloudExecArray.mdx index 1023d5c..ffdc3d9 100644 --- a/sqlite-cloud/sdks/c/SQCloudExecArray.mdx +++ b/sqlite-cloud/sdks/c/SQCloudExecArray.mdx @@ -10,10 +10,10 @@ SQCloudResult *SQCloudExecArray (SQCloudConnection *connection, const char *comm ``` ### Description -Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). This function is equivalent to the [SQCloudExec](/docs/sdk/c/sqcloudexec) function but special placeholders can be used to bind values to the statement (most of the time avoiding the need to perform copies and to encode data). +Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). This function is equivalent to the [SQCloudExec](/docs/sdks/c/sqcloudexec) function but special placeholders can be used to bind values to the statement (most of the time avoiding the need to perform copies and to encode data). ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **command**: a NULL terminated string with the command to execute * **values**: an array of n values * **len**: an array of n length @@ -21,7 +21,7 @@ Submits a command to the server and waits for the result. The command can be any * **n** number of array elements ### Return value -A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdk/c/sqcloudresultfree) +A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdks/c/sqcloudresultfree) ### Example ```c diff --git a/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx b/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx index ad91dea..61950a2 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx @@ -10,7 +10,7 @@ double SQCloudResultDouble (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Double value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Double value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultDump.mdx b/sqlite-cloud/sdks/c/SQCloudResultDump.mdx index deb2514..d972b29 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultDump.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultDump.mdx @@ -13,7 +13,7 @@ void SQCloudResultDump (SQCloudConnection *connection, SQCloudResult *result); Print the result on standard output. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **result**: A valid SQCloudResult pointer returned by an SQCloud function. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx b/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx index 4fa8b70..b7bf297 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx @@ -10,7 +10,7 @@ float SQCloudResultFloat (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Float value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Float value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx b/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx index 567e946..72d1682 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx @@ -10,7 +10,7 @@ int32_t SQCloudResultInt32 (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int32 value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int32 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx b/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx index dc78c43..fec15a0 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx @@ -10,7 +10,7 @@ int64_t SQCloudResultInt64 (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int64 value. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int64 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx index fba7236..10fb855 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudRowsetCols (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of columns in the Rowset. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of columns in the Rowset. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx index 54f1f95..209f16c 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx @@ -10,11 +10,11 @@ char *SQCloudRowsetColumnName (SQCloudResult *result, uint32_t col, uint32_t *le ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the name of a column. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the name of a column. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) * **len**: On output the column name length ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx index fddc77e..c8f9c38 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx @@ -10,12 +10,12 @@ double SQCloudRowsetDoubleValue (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Double value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Double value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) ### Return value A `double` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx index cef4dae..967528b 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx @@ -10,12 +10,12 @@ float SQCloudRowsetFloatValue (SQCloudResult *result, uint32_t row, uint32_t col ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Float value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Float value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) ### Return value A `float` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx index dec580a..e5f8b25 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx @@ -10,12 +10,12 @@ int32_t SQCloudRowsetInt32Value (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int32_t` value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int32_t` value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int32_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx index ba2a731..2e954b6 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx @@ -10,12 +10,12 @@ int64_t SQCloudRowsetInt64Value (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int64_t` value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int64_t` value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int64_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx index 96bb0fa..a3e8835 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudRowsetRows (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of rows in the Rowset. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of rows in the Rowset. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx index 4fcbdfe..cc2ed68 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx @@ -10,12 +10,12 @@ char *SQCloudRowsetValue (SQCloudResult *result, uint32_t row, uint32_t col, uin ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve a pointer and a length for a rowset item identified by a given row and column index. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve a pointer and a length for a rowset item identified by a given row and column index. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) * **len**: On output the length of the returned buffer ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx index 25f62a8..3c2021b 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx @@ -10,12 +10,12 @@ SQCLOUD_VALUE_TYPE SQCloudRowsetValueType (SQCloudResult *result, uint32_t row, ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdk/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the type of each rowset item identified by a given row and column index. +If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the type of each rowset item identified by a given row and column index. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdk/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdk/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int` represented by the SQCLOUD_VALUE_TYPE enum type: diff --git a/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx b/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx index 908c4ef..1dbd661 100644 --- a/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx +++ b/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx @@ -14,7 +14,7 @@ By using **SQCloudSetPubSubCallback**, you can set a callback function that will ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **callback**: the C callback to be called in each notification * **data**: custom data to be transparently passed to the callback @@ -31,7 +31,6 @@ Nothing. static my_callback(SQCloudConnection *connection, SQCloudResult *result, void *data) { // dump JSON notification - // more about the JSON format: https://docs.sqlitecloud.io/docs/introduction/pubsub_payload SQCloudResultDump(connection, result); } diff --git a/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx b/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx index a9175c5..a9219d9 100644 --- a/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx +++ b/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx @@ -10,10 +10,10 @@ SQCloudResult *SQCloudSetPubSubOnly (SQCloudConnection *connection); ``` ### Description -When Pub/Sub is activated (after calling [SQCloudSetPubSubCallback](/docs/sdk/c/sqcloudsetpubsubcallback)) there are two sockets associated to the SQCloudConnection connection. The **SQCloudSetPubSubOnly** function closes the **main** socket, leaving the **pub/sub** socket opened and ready to receive incoming notifications from subscripted channels and tables. +When Pub/Sub is activated (after calling [SQCloudSetPubSubCallback](/docs/sdks/c/sqcloudsetpubsubcallback)) there are two sockets associated to the SQCloudConnection connection. The **SQCloudSetPubSubOnly** function closes the **main** socket, leaving the **pub/sub** socket opened and ready to receive incoming notifications from subscripted channels and tables. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) ### Return value An OK result is succesfully executed, otherwise an error. diff --git a/sqlite-cloud/sdks/c/SQCloudUUID.mdx b/sqlite-cloud/sdks/c/SQCloudUUID.mdx index 82c2f56..27c2e3e 100644 --- a/sqlite-cloud/sdks/c/SQCloudUUID.mdx +++ b/sqlite-cloud/sdks/c/SQCloudUUID.mdx @@ -13,7 +13,7 @@ const char *SQCloudUUID (SQCloudConnection *connection); The **SQCloudUUID** function returns the unique client UUID value. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) ### Return value A NULL terminated string that contains the unique client UUID value. diff --git a/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx b/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx index 4031ec9..676fa76 100644 --- a/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx +++ b/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx @@ -14,7 +14,7 @@ bool SQCloudUploadDatabase (SQCloudConnection *connection, const char *dbname, c Initiate an SQLite database upload to an already connected SQLite Cloud node. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **dbname**: the name of the database on server-side once uploaded will be completed * **key**: encryption database key (if any) * **xdata**: a pointer to an opaque datatype that will be passed as-is to the callback diff --git a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx index c8506e1..24c9c16 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx @@ -17,7 +17,7 @@ bool SQCloudVMBindZeroBlob (SQCloudVM *vm, int index, int64_t len); ### Description Bind a value to a compiled SQL statement. -In the SQL statement text input to [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile), literals may be replaced by a parameter that matches one of following templates: +In the SQL statement text input to [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile), literals may be replaced by a parameter that matches one of following templates: * ? * ?NNN * :VVV @@ -29,8 +29,8 @@ These functions resemble the [sqlite3_bind_*](https://www.sqlite.org/c3ref/bind_ ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). -* **index**: Represents the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1. When the same named SQL parameter is used more than once, second and subsequent occurrences have the same index as the first occurrence. The index for named parameters can be looked up using the [SQCloudVMBindParameterIndex](/docs/sdk/c/sqcloudvmbindparameterindex) API if desired. The index for "?NNN" parameters is the value of NNN. +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **index**: Represents the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1. When the same named SQL parameter is used more than once, second and subsequent occurrences have the same index as the first occurrence. The index for named parameters can be looked up using the [SQCloudVMBindParameterIndex](/docs/sdks/c/sqcloudvmbindparameterindex) API if desired. The index for "?NNN" parameters is the value of NNN. * **value**: The the value to bind to the parameter. * **len**: The number of bytes in the parameter. To be clear: the value is the number of bytes in the value, not the number of characters. diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx index a1ab262..c4d4f61 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx @@ -15,7 +15,7 @@ This routine can be used to find the number of SQL parameters in a prepared stat This function resembles the [bind_parameter_count](https://www.sqlite.org/c3ref/bind_parameter_count.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx index be06db1..8fd32cf 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx @@ -10,12 +10,12 @@ int SQCloudVMBindParameterIndex (SQCloudVM *vm, const char *name); ``` ### Description -Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to [SQCloudVMBind](/docs/sdk/c/sqcloudvmbind). A zero is returned if no matching parameter is found. +Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to [SQCloudVMBind](/docs/sdks/c/sqcloudvmbind). A zero is returned if no matching parameter is found. This function resembles the [bind_parameter_index](https://www.sqlite.org/c3ref/bind_parameter_index.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). * **name**: The SQL parameter name. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx index dce7a6f..59bac7c 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx @@ -18,7 +18,7 @@ If the value of index is out of range or if the N-th parameter is nameless, then This function resembles the [bind_parameter_name](https://www.sqlite.org/c3ref/bind_parameter_name.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). * **index**: The SQL parameter index. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx b/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx index 479a979..2701188 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx @@ -18,7 +18,7 @@ If you need to get the changes from a SQCloudConnection object you can send a `D ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx index b2a6c15..6e88a37 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx @@ -15,7 +15,7 @@ This function resembles the [sqlite3_finalize](https://www.sqlite.org/c3ref/fina ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx index 0dac957..823434f 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx @@ -21,8 +21,8 @@ These functions resemble the [sqlite3_column_*](https://www.sqlite.org/c3ref/col ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). -* **index**: The index of the column for which information should be returned. The leftmost column of the result set has the index 0. The number of columns in the result can be determined using [SQCloudVMColumnCount](/docs/sdk/c/sqcloudvmcolumncount). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **index**: The index of the column for which information should be returned. The leftmost column of the result set has the index 0. The number of columns in the result can be determined using [SQCloudVMColumnCount](/docs/sdks/c/sqcloudvmcolumncount). * **len**: The number of bytes of the returned value. The **SQCloudVMColumnType** routine returns the datatype code for the initial data type of the result column. The returned value is one of following: diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx index ef01411..1be9cc8 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx @@ -16,7 +16,7 @@ This function resembles the [sqlite3_column_count](https://sqlite.org/c3ref/colu ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). Return value An `int` with the number of columns. diff --git a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx index f278c1a..e74f695 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx @@ -14,7 +14,7 @@ Compile an SQL statement into a byte-code virtual machine. This function resembles the [sqlite3_prepare](https://www.sqlite.org/c3ref/prepare.html) SQLite API. ### Parameters -* **connection**: A valid connection object obtained by [SQCloudConnect](/docs/sdk/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdk/c/sqcloudconnectwithstring) +* **connection**: A valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) * **sql**: The statement to be compiled. * **len**: If the len argument is negative, then sql is read up to the first zero terminator. If len is positive, then it is the number of bytes read from sql. * **tail**: If the tail argument is not NULL then *tail is made to point to the first byte past the end of the first SQL statement in sql. SQCloudVMCompile compiles only the first statement in sql, so *tail is left pointing to what remains uncompiled. diff --git a/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx b/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx index b6421ed..6a8556b 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx @@ -14,7 +14,7 @@ Retrieve the latest error code (if any) from the associated vm. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx b/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx index 5c3c44f..f61a1e9 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx @@ -14,7 +14,7 @@ Retrieve the latest error message (if any) from the associated vm. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx index 3cc8e16..d279f85 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx @@ -13,7 +13,7 @@ int SQCloudVMIsExplain (SQCloudVM *vm); The **SQCloudVMIsExplain** interface returns 1 if the prepared statement S is an EXPLAIN statement, or 2 if the statement S is an EXPLAIN QUERY PLAN. **SQCloudVMIsExplain** interface returns 0 if the statement is an ordinary statement or a NULL pointer. This function resembles the [sqlite3_stmt_isexplain](https://www.sqlite.org/c3ref/stmt_isexplain.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value An `int` value representing if the original statement was an EXPLAIN. diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx index 4491e59..54e1a0e 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx @@ -10,11 +10,11 @@ bool SQCloudVMIsFinalized (SQCloudVM *vm); ``` ### Description -The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sdk/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the [sqlite3_stmt_busy](https://www.sqlite.org/c3ref/stmt_busy.html) SQLite API. +The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sdks/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the [sqlite3_stmt_busy](https://www.sqlite.org/c3ref/stmt_busy.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx index 5aca6d9..020a80c 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx @@ -13,7 +13,7 @@ bool SQCloudVMIsReadOnly (SQCloudVM *vm); The **SQCloudVMIsReadOnly** interface returns true if and only if the prepared statement bound to vm makes no direct changes to the content of the database file. This routine returns false if there is any possibility that the statement might change the database file. A false return does not guarantee that the statement will change the database file. This function resembles the [sqlite3_stmt_readonly](https://www.sqlite.org/c3ref/stmt_readonly.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx b/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx index 84fda71..52dc0a8 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx @@ -21,7 +21,7 @@ If you need to get the last inserted rowid from a SQCloudConnection object you c ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMResult.mdx b/sqlite-cloud/sdks/c/SQCloudVMResult.mdx index de15189..f250935 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMResult.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMResult.mdx @@ -13,7 +13,7 @@ SQCloudResult *SQCloudVMResult (SQCloudVM *vm); Retrieve the raw SQCloudResult associated with the VM. You can then use the SQCloudResult API to further process the SQCloudResult. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx index 507ed3d..8203352 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx @@ -10,11 +10,11 @@ SQCLOUD_RESULT_TYPE SQCloudVMStep (SQCloudVM *vm); ``` ### Description -Evaluate an SQL statement previously compiled by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +Evaluate an SQL statement previously compiled by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). This function resembles the [sqlite3_step](https://www.sqlite.org/c3ref/step.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx b/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx index 333c7b6..3463378 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx @@ -19,7 +19,7 @@ If you need to get the total changes from a SQCloudConnection object you can sen ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdk/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). ### Return value An `int64_t` with the number of total changes. diff --git a/sqlite-cloud/sdks/go/introduction.mdx b/sqlite-cloud/sdks/go/introduction.mdx index a6d96f7..382e500 100644 --- a/sqlite-cloud/sdks/go/introduction.mdx +++ b/sqlite-cloud/sdks/go/introduction.mdx @@ -77,9 +77,9 @@ sqlitecloud://user:pass@host.com:port/dbname?timeout=10&key2=value2&key3=value3 To get a valid connection string, follow these instructions: -- Get a [SQLite Cloud](https://sqlitecloud.io/) account. See the [documentation](https://docs.sqlitecloud.io/docs/introduction/login) for details. -- Create a [SQLite Cloud project](https://docs.sqlitecloud.io/docs/introduction/projects) -- Create a [SQLite Cloud database](https://docs.sqlitecloud.io/docs/introduction/databases) +- Get a [SQLite Cloud](https://sqlitecloud.io/register) account. See the documentation for details. +- Create a SQLite Cloud project +- Create a SQLite Cloud database - Get the connection string by clicking on the node address in the [Dashboard Nodes](https://docs.sqlitecloud.io/docs/introduction/nodes) section. A valid connection string will be copied to your clipboard. - Add the database name to your connection string. diff --git a/sqlite-cloud/sdks/js/introduction.mdx b/sqlite-cloud/sdks/js/introduction.mdx index 170e23a..b129ade 100644 --- a/sqlite-cloud/sdks/js/introduction.mdx +++ b/sqlite-cloud/sdks/js/introduction.mdx @@ -32,7 +32,7 @@ let results = await database.sql`SELECT * FROM tracks WHERE name = ${name}` // => returns [{ AlbumId: 1, Name: 'Breaking The Rules', Composer: 'Angus Young... }] ``` -Use [Database.sql](/docs/sdk/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. +Use [Database.sql](/docs/sdks/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. We aim for full compatibility with the established [sqlite3 API](https://www.npmjs.com/package/sqlite3), with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlitecloud.io) while continuing to use your existing codebase. From 45cb35be3a3914888d0a9b0897e16426b53c992d Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 8 Jul 2024 16:02:52 +0200 Subject: [PATCH 020/185] remove link --- sqlite-cloud/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index b2f3012..ee4cd6d 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -29,6 +29,6 @@ SQLite Cloud provides a comprehensive suite of tools for building realtime, loca * **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. * **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. +* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. * **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. * **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. From 256496ea21b026f50c0766f1f95bb0fb165c1ce2 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:22:08 -0400 Subject: [PATCH 021/185] Completed Next.js JS project Quickstart page and added left nav link; templated Prisma ORM Quickstart page --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/quick-start-next.mdx | 82 ++++++++++++++++++++++++++- sqlite-cloud/quick-start-prisma.mdx | 87 +++++++++++++++++++++++++++++ sqlite-cloud/quick-start-react.mdx | 2 +- 4 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 sqlite-cloud/quick-start-prisma.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index b787f5b..bfc2bd7 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -12,6 +12,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "React", filePath: "sqlite-cloud/quick-start-react", type: "inner", level: 1 }, { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + // { title: "Prisma ORM", filePath: "quick-start-prisma", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index e32c6bd..283e5ff 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -1,9 +1,87 @@ --- -title: Next Quick Start Guide +title: Next.js Quick Start Guide description: Get started with SQLite Cloud using Next.js. category: getting-started status: publish slug: quick-start-next --- -In this quickstart, we will show you how to get started with SQLite Cloud and Next.js by building a simple application that connects to and reads from a SQLite Cloud database. \ No newline at end of file +In this quickstart, we will show you how to get started with SQLite Cloud and Next.js by building a simple application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. +2. **Create a Next.js app** + - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. +```bash +npx create-next-app@latest sqlc-quickstart --js --no-tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm +``` +3. **Install the SQLite Cloud SDK** +```bash +cd sqlc-quickstart && npm install @sqlitecloud/drivers +``` +4. **Query data** + - Replace the code in ```layout.js``` and ```page.js``` with the following snippets. + - Click a node in your account dashboard and copy the connection string. Replace `````` in ```page.js``` with your connection string. + +In ```src/app/layout.js```: +```jsx +export const metadata = { + title: 'Create Next App', + description: 'Generated by create next app', +}; + +export default function RootLayout({ children }) { + return ( + + {children} + + ); +} +``` + +In ```src/app/page.js```: +```jsx +import { Database } from '@sqlitecloud/drivers'; + +async function getAlbums() { + const db = new Database(''); + + const result = await db.sql`USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`; + + return result; +} + +export default async function Home() { + const res = await getAlbums(); + + return ( +
+

Albums

+
    + {res.map(({ id, title, artist }) => ( +
  • + {title} by {artist} +
  • + ))} +
+
+ ); +} +``` + +5. **Run your app** +```bash +npm run dev +``` +6. **View your app** + - Open your browser and navigate to the localhost link provided by the previous command to see your app data. + +And that's it! You've successfully built a Next app that reads data from a SQLite Cloud database. \ No newline at end of file diff --git a/sqlite-cloud/quick-start-prisma.mdx b/sqlite-cloud/quick-start-prisma.mdx new file mode 100644 index 0000000..f773352 --- /dev/null +++ b/sqlite-cloud/quick-start-prisma.mdx @@ -0,0 +1,87 @@ +--- +title: Prisma Quick Start Guide +description: Get started with SQLite Cloud using Prisma ORM. +category: getting-started +status: publish +slug: quick-start-prisma +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Prisma by building a simple application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. +2. **Create a Next.js app** + - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. +```bash +npx create-next-app@latest sqlc-quickstart --js --no-tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm +``` +3. **Install the SQLite Cloud SDK** +```bash +cd sqlc-quickstart && npm install @sqlitecloud/drivers +``` +4. **Query data** + - Replace the code in ```layout.js``` and ```page.js``` with the following snippets. + - Click a node in your account dashboard and copy the connection string. Replace `````` in ```page.js``` with your connection string. + +In ```src/app/layout.js```: +```jsx +export const metadata = { + title: 'Create Next App', + description: 'Generated by create next app', +}; + +export default function RootLayout({ children }) { + return ( + + {children} + + ); +} +``` + +In ```src/app/page.js```: +```jsx +import { Database } from '@sqlitecloud/drivers'; + +async function getAlbums() { + const db = new Database(''); + + const result = await db.sql`USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`; + + return result; +} + +export default async function Home() { + const res = await getAlbums(); + + return ( +
+

Albums

+
    + {res.map(({ id, title, artist }) => ( +
  • + {title} by {artist} +
  • + ))} +
+
+ ); +} +``` + +5. **Run your app** +```bash +npm run dev +``` +6. **View your app** + - Open your browser and navigate to the localhost link provided by the previous command to see your app data. + +And that's it! You've successfully built a Next app that reads data from a SQLite Cloud database. \ No newline at end of file diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index ce6ef72..daa6af9 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -67,7 +67,7 @@ export default App npm run dev ``` 6. **View your app** - - Open your browser and navigate to `http://localhost:3000` to see your app in action. + - Open your browser and navigate to the localhost link provided by the previous command to see your app data. And that's it! You've successfully built a React app that reads data from a SQLite Cloud database. From 5d0d5f21a462cb4ece7f67f16ee96da1ca793b60 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:09:38 +0200 Subject: [PATCH 022/185] test underscore --- sqlite-cloud/{multi-code-example.mdx => _multi-code-example.mdx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sqlite-cloud/{multi-code-example.mdx => _multi-code-example.mdx} (100%) diff --git a/sqlite-cloud/multi-code-example.mdx b/sqlite-cloud/_multi-code-example.mdx similarity index 100% rename from sqlite-cloud/multi-code-example.mdx rename to sqlite-cloud/_multi-code-example.mdx From c29dd5f6ae8137bf7d539c0ecdc99d5c822bc5dd Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:16:40 +0200 Subject: [PATCH 023/185] removed test underscore --- sqlite-cloud/multi-code-example.mdx | 119 ++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sqlite-cloud/multi-code-example.mdx diff --git a/sqlite-cloud/multi-code-example.mdx b/sqlite-cloud/multi-code-example.mdx new file mode 100644 index 0000000..e98af34 --- /dev/null +++ b/sqlite-cloud/multi-code-example.mdx @@ -0,0 +1,119 @@ +--- +title: Multi Code Component Examples +description: Multi Code Component Examples +slug: components/multicode +category: getting-started +status: draft +--- +import MultiCode from '@commons-components/Code/MultiCode.astro'; + + +In this examples, we will show how to use the `MultiCode` component: + +- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/MultiCode.astro) the definition of the `MultiCode` component. +- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/Code.astro) the definition of the `Code` component that is used inside the `MultiCode` component. + + +In these two files there are the TypeScript definitions usefull to know all the avaible properties. + +The MultiCode + +--- +## First example + +export const WebliteSourceCode = ` + +
+ + +
`; + +export const SwiftSourceCode = `let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey") +let sqliteCloud = SQLiteCloud(configuration) + +do { + try await sqliteCloud.connect() + debugPrint("connected") +} catch { + debugPrint("connection error: \(error)") // SQLiteCloudConnectionError +}`; + + +export const codeExamplesOne = [ + { + sliderItem: "Web", + codeLines: WebliteSourceCode, + lang: "html", + // docHref: "htts://google.com", + gitHref: "htts://google.com", + }, + { + sliderItem: "Swift", + lang: "swift", + codeLines: SwiftSourceCode, + docHref: "", + gitHref: "", + } +]; + + + +--- + +## Second example + + +export const PHPSourceCode = `$sqliteCloudConnectionString = 'sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey'; +$sqlite = new SQLiteCloudClient(); +$sqlite->connectWithString($sqliteCloudConnectionString);`; + +export const JSSourceCode = `import SQLiteCloud from 'sqlitecloud-sdk' +const client = new SQLiteCloud(projectId, apikey, onErrorCallback, onCloseCallback); + +await client.connect(); +const database = "chinook.db" +let name = 'Breaking The Rules' +let results = await localClient.exec(\`USE DATABASE \${database}; SELECT * FROM tracks WHERE name = \${name}\`);`; + +export const NodeSourceCode = `import { Database } from 'sqlitecloud-js' + +let database = new Database('sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey') +let name = 'Breaking The Rules' +let results = await database.sql\`\`SELECT * FROM tracks WHERE name = \${name}\`\` +`; + +export const codeExamplesTwo = [ + { + sliderItem: "PHP", + codeLines: PHPSourceCode, + lang: "php", + // docHref: "htts://google.com", + gitHref: "htts://google.com", + }, + { + sliderItem: "Web", + lang: "javascript", + codeLines: JSSourceCode, + docHref: "", + gitHref: "", + }, + { + sliderItem: "NodeJS", + lang: "javascript", + codeLines: NodeSourceCode, + docHref: "", + gitHref: "", + } +]; + + + + From 2805913b5a07b5cb02e9751dc402a8aa3e18a9b1 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:17:16 +0200 Subject: [PATCH 024/185] removed test underscore --- sqlite-cloud/_multi-code-example.mdx | 119 --------------------------- 1 file changed, 119 deletions(-) delete mode 100644 sqlite-cloud/_multi-code-example.mdx diff --git a/sqlite-cloud/_multi-code-example.mdx b/sqlite-cloud/_multi-code-example.mdx deleted file mode 100644 index e98af34..0000000 --- a/sqlite-cloud/_multi-code-example.mdx +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Multi Code Component Examples -description: Multi Code Component Examples -slug: components/multicode -category: getting-started -status: draft ---- -import MultiCode from '@commons-components/Code/MultiCode.astro'; - - -In this examples, we will show how to use the `MultiCode` component: - -- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/MultiCode.astro) the definition of the `MultiCode` component. -- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/Code.astro) the definition of the `Code` component that is used inside the `MultiCode` component. - - -In these two files there are the TypeScript definitions usefull to know all the avaible properties. - -The MultiCode - ---- -## First example - -export const WebliteSourceCode = ` - -
- - -
`; - -export const SwiftSourceCode = `let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey") -let sqliteCloud = SQLiteCloud(configuration) - -do { - try await sqliteCloud.connect() - debugPrint("connected") -} catch { - debugPrint("connection error: \(error)") // SQLiteCloudConnectionError -}`; - - -export const codeExamplesOne = [ - { - sliderItem: "Web", - codeLines: WebliteSourceCode, - lang: "html", - // docHref: "htts://google.com", - gitHref: "htts://google.com", - }, - { - sliderItem: "Swift", - lang: "swift", - codeLines: SwiftSourceCode, - docHref: "", - gitHref: "", - } -]; - - - ---- - -## Second example - - -export const PHPSourceCode = `$sqliteCloudConnectionString = 'sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey'; -$sqlite = new SQLiteCloudClient(); -$sqlite->connectWithString($sqliteCloudConnectionString);`; - -export const JSSourceCode = `import SQLiteCloud from 'sqlitecloud-sdk' -const client = new SQLiteCloud(projectId, apikey, onErrorCallback, onCloseCallback); - -await client.connect(); -const database = "chinook.db" -let name = 'Breaking The Rules' -let results = await localClient.exec(\`USE DATABASE \${database}; SELECT * FROM tracks WHERE name = \${name}\`);`; - -export const NodeSourceCode = `import { Database } from 'sqlitecloud-js' - -let database = new Database('sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey') -let name = 'Breaking The Rules' -let results = await database.sql\`\`SELECT * FROM tracks WHERE name = \${name}\`\` -`; - -export const codeExamplesTwo = [ - { - sliderItem: "PHP", - codeLines: PHPSourceCode, - lang: "php", - // docHref: "htts://google.com", - gitHref: "htts://google.com", - }, - { - sliderItem: "Web", - lang: "javascript", - codeLines: JSSourceCode, - docHref: "", - gitHref: "", - }, - { - sliderItem: "NodeJS", - lang: "javascript", - codeLines: NodeSourceCode, - docHref: "", - gitHref: "", - } -]; - - - - From 5cc55af340b55646f4a1b9b0bd0e9917a1cfe69c Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:20:18 +0200 Subject: [PATCH 025/185] test multiple spaces in slug --- sqlite-cloud/quick-start-node.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index ccd4966..460decc 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -3,7 +3,7 @@ title: Node.js Quick Start Guide description: Get started with SQLite Cloud using Node.js and Express. category: getting-started status: publish -slug: quick-start-node +slug: quick-start-node --- In this quickstart, we will show you how to get started with SQLite Cloud and Node.js by building a simple web server that connects to and reads from a SQLite Cloud database, then serves that data to the client. From 47ce20f562920777fd0736d38df76c3acdf48a97 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:57:23 +0200 Subject: [PATCH 026/185] Add 'ref' to allow multiple references in nav to same doc #43 --- sqlite-cloud/_nav.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 9c396ed..b739d3a 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -127,6 +127,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "JavaScript", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/js/getting-started", level: 1 }, + { title: "React", ref: "/docs/sqlite-cloud/quick-start-react", type: "inner", level: 1 }, { title: "Python", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, From 6d1f76a1375b70f40b1078ae79d3c5a3843171d9 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:57:36 +0200 Subject: [PATCH 027/185] removed test spaces --- sqlite-cloud/quick-start-node.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 460decc..ccd4966 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -3,7 +3,7 @@ title: Node.js Quick Start Guide description: Get started with SQLite Cloud using Node.js and Express. category: getting-started status: publish -slug: quick-start-node +slug: quick-start-node --- In this quickstart, we will show you how to get started with SQLite Cloud and Node.js by building a simple web server that connects to and reads from a SQLite Cloud database, then serves that data to the client. From 0f9bd4eed51efbc2f56f5e9028403ccf3a91ac92 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 15:57:48 +0200 Subject: [PATCH 028/185] removed unused classes --- sqlite-cloud/sdks/go/getting-started.mdx | 1 - sqlite-cloud/sdks/js/classes/Database.md | 2 +- sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md | 2 +- sqlite-cloud/sdks/js/classes/SQLiteCloudError.md | 2 +- sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md | 2 +- sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md | 2 +- sqlite-cloud/sdks/js/classes/Statement.md | 2 +- sqlite-cloud/sdks/js/getting-started.mdx | 2 +- sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md | 2 +- sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md | 2 +- sqlite-cloud/sdks/js/modules.md | 2 +- sqlite-cloud/sdks/php/getting-started.mdx | 1 - sqlite-cloud/sdks/php/methods.mdx | 1 - sqlite-cloud/sdks/python/introduction.mdx | 2 +- 14 files changed, 11 insertions(+), 14 deletions(-) diff --git a/sqlite-cloud/sdks/go/getting-started.mdx b/sqlite-cloud/sdks/go/getting-started.mdx index 096d0c5..6c26c67 100644 --- a/sqlite-cloud/sdks/go/getting-started.mdx +++ b/sqlite-cloud/sdks/go/getting-started.mdx @@ -1,7 +1,6 @@ --- title: GO SDK Getting Started description: Here's the how gettting started to use the SQLite Cloud in your Go code. -customClass: sdk-doc badge-doc go-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/Database.md b/sqlite-cloud/sdks/js/classes/Database.md index 6c138ca..8d943a0 100644 --- a/sqlite-cloud/sdks/js/classes/Database.md +++ b/sqlite-cloud/sdks/js/classes/Database.md @@ -1,7 +1,7 @@ --- title: Database description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md index e929584..545bc6c 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md @@ -1,7 +1,7 @@ --- title: SQLiteCloudConnection description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md index f080ec1..33969cc 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md @@ -1,7 +1,7 @@ --- title: SQLiteCloudError description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md index 104ae7f..c39b217 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md @@ -1,7 +1,7 @@ --- title: SQLiteCloudRow description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md index 2bb6c4e..7cd5824 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md @@ -1,7 +1,7 @@ --- title: SQLiteCloudRowset description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/classes/Statement.md b/sqlite-cloud/sdks/js/classes/Statement.md index 0fa438a..c068a3c 100644 --- a/sqlite-cloud/sdks/js/classes/Statement.md +++ b/sqlite-cloud/sdks/js/classes/Statement.md @@ -1,7 +1,7 @@ --- title: Statement description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/getting-started.mdx b/sqlite-cloud/sdks/js/getting-started.mdx index ead3f32..702423c 100644 --- a/sqlite-cloud/sdks/js/getting-started.mdx +++ b/sqlite-cloud/sdks/js/getting-started.mdx @@ -1,7 +1,7 @@ --- title: JS SDK Introduction description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md b/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md index c89ad0a..99788a0 100644 --- a/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md +++ b/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md @@ -1,7 +1,7 @@ --- title: SQLCloudRowsetMetadata description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md b/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md index 32e3ff0..5b2906e 100644 --- a/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md +++ b/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md @@ -1,7 +1,7 @@ --- title: SQLiteCloudConfig description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 23c8f07..598cdf4 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -1,7 +1,7 @@ --- title: Modules description: SQLite Cloud Javascript SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/php/getting-started.mdx b/sqlite-cloud/sdks/php/getting-started.mdx index bdf9084..fed4252 100644 --- a/sqlite-cloud/sdks/php/getting-started.mdx +++ b/sqlite-cloud/sdks/php/getting-started.mdx @@ -1,7 +1,6 @@ --- title: PHP SDK Getting Started description: Get started with SQLite Cloud using PHP. -customClass: sdk-doc badge-doc php-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/php/methods.mdx b/sqlite-cloud/sdks/php/methods.mdx index 6aa8c79..50f9bf7 100644 --- a/sqlite-cloud/sdks/php/methods.mdx +++ b/sqlite-cloud/sdks/php/methods.mdx @@ -1,7 +1,6 @@ --- title: PHP SDK Methods description: Methods available in the SQLite Cloud PHP SDK. -customClass: sdk-doc badge-doc php-doc category: sdks status: publish --- diff --git a/sqlite-cloud/sdks/python/introduction.mdx b/sqlite-cloud/sdks/python/introduction.mdx index 516dfdd..534b7fe 100644 --- a/sqlite-cloud/sdks/python/introduction.mdx +++ b/sqlite-cloud/sdks/python/introduction.mdx @@ -1,7 +1,7 @@ --- title: Python SDK Introduction description: SQLite Cloud Python SDK -customClass: sdk-doc badge-doc js-doc +customClass: sdk-doc js-doc category: sdks status: publish slug: sdk-python-introduction From acd169616d224c69aa6b4a4e5a7f27a37fd1e6cd Mon Sep 17 00:00:00 2001 From: Gioele Cantoni Date: Thu, 11 Jul 2024 16:23:53 +0200 Subject: [PATCH 029/185] updated action version --- .github/workflows/search.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 96b127e..4a9ee05 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -13,12 +13,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: sqlitecloud/docsearch-action@v3 + - uses: sqlitecloud/docsearch-action@v4 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} database: documentation.sqlite - strip-astro-header: true + use-front-matter: true strip-md-titles: true strip-jsx: true strip-html: true From 9a4a8378a6630a55dcc022bf4ab0f354a160bc7a Mon Sep 17 00:00:00 2001 From: Gioele Cantoni Date: Thu, 11 Jul 2024 16:25:17 +0200 Subject: [PATCH 030/185] updated action version --- .github/workflows/search.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 96b127e..4a9ee05 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -13,12 +13,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: sqlitecloud/docsearch-action@v3 + - uses: sqlitecloud/docsearch-action@v4 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} database: documentation.sqlite - strip-astro-header: true + use-front-matter: true strip-md-titles: true strip-jsx: true strip-html: true From 7ade519b51065f728b2fade039b15fdddc6f1a27 Mon Sep 17 00:00:00 2001 From: tizianot Date: Thu, 11 Jul 2024 16:29:02 +0200 Subject: [PATCH 031/185] added multicode wrapper --- sqlite-cloud/multi-code-example.mdx | 2 +- sqlite-cloud/test-wrapper-multi.mdx | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 sqlite-cloud/test-wrapper-multi.mdx diff --git a/sqlite-cloud/multi-code-example.mdx b/sqlite-cloud/multi-code-example.mdx index e98af34..e2403a0 100644 --- a/sqlite-cloud/multi-code-example.mdx +++ b/sqlite-cloud/multi-code-example.mdx @@ -1,7 +1,7 @@ --- title: Multi Code Component Examples description: Multi Code Component Examples -slug: components/multicode +slug: multicode category: getting-started status: draft --- diff --git a/sqlite-cloud/test-wrapper-multi.mdx b/sqlite-cloud/test-wrapper-multi.mdx new file mode 100644 index 0000000..3ad8132 --- /dev/null +++ b/sqlite-cloud/test-wrapper-multi.mdx @@ -0,0 +1,19 @@ +--- +title: Multi Code Component Examples +description: Multi Code Component Examples +slug: wrapper-multicode +category: getting-started +status: draft +--- +import ReactCodeExample from "@docs-website-assets/code-examples/ReactCodeExample.astro"; + + + + + + + + + + + From 8b09ba33c909be066edcacd4cc1032341452ce3d Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:21:07 -0400 Subject: [PATCH 032/185] Completed web CDN Quickstart guide --- sqlite-cloud/_nav.ts | 5 +- sqlite-cloud/quick-start-cdn.mdx | 175 +++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 sqlite-cloud/quick-start-cdn.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index a86ad1d..6b297ec 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -9,10 +9,11 @@ const sidebarNav: SidebarNavStruct = [ { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - // { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, - // { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-cdn.mdx b/sqlite-cloud/quick-start-cdn.mdx new file mode 100644 index 0000000..da1c43a --- /dev/null +++ b/sqlite-cloud/quick-start-cdn.mdx @@ -0,0 +1,175 @@ +--- +title: CDN Quick Start Guide +description: Get started with SQLite Cloud using a Content Delivery Network +category: getting-started +status: publish +slug: quick-start-cdn +--- + +In this quickstart, we demonstrate how to locally serve the SQLite Cloud JS Drivers from a CDN. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a JavaScript / TypeScript app** + - The following commands bootstrap a TypeScript app. +```bash +mkdir sqlc-quickstart +cd sqlc-quickstart + +npm init -y +npm install typescript ts-node @types/node --save-dev +npx tsc --init +``` + +3. **Install the SQLite Cloud JS SDK** +```bash +npm install @sqlitecloud/drivers +``` + +4. **Load our example in your browser** + +Copy the following to your ```index.html``` file: +```html + + + + + SQLite Cloud CDN Quickstart + + + + + +

+ SQLite Cloud Example: Checking Chinook Customers +

+ +
+ + + + +
+ + +

Results:

+
    + + + + +``` + + - This HTML form sends a query to the `chinook.sqlite` database. You can load the form by simply dragging and dropping the file into your browser. + - To use SQLite Cloud's JS drivers, the example includes an additional script in the `` tag: ``. Update `{version}` with the most recent repo release. + +5. **Query data** + - There are 2 ways to query data. + 1. In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and paste it into the form's `Database Connection String` input. The expected string format is: `sqlitecloud://{host}.sqlite.cloud:8860?apikey={apikey}`. + + - Since this Connection String format does NOT contain the database to query, you MUST include the database name in your query. The expected query format is: `USE DATABASE {database}; select * from {table}`. + - IMPORTANT: The example SQL we provide (`USE DATABASE chinook.sqlite; select * from customers limit 3`) queries the `customers` table in the `chinook` database. The results are specifically parsed to be more readable. To display raw data from any table, uncomment the `index.html` code starting after `// list raw data` and comment out the later `for` loop. + + 2. An alternative Connection String format is: `sqlitecloud://{username}:{password}@{host}.sqlite.cloud:8860/{database}`. + + - Since this Connection String format DOES contain the database to query, you can exclude the database name from your query: `select * from {table}`. + - To get your admin username, go to your SQLite Cloud account dashboard. In the left nav, open Security and select Users. Your admin username has already been created. Replace `{username}` the connection string. + - To set your admin user's password, click the row's down chevron and select Edit. Enter a new Password and click Save. Replace `{password}` in the connection string. + - To get the host, see under your Project name `{host}.sqlite.cloud`. + - To get the database name, in the left nav, open Databases and select Tables. All of your databases are listed in the Select Database dropdown. + + - Send your query! Returned results will be listed, from most to least recent, below the form inputs. + +And that's it! You've successfully submitted a simple form to read data from a SQLite Cloud database. \ No newline at end of file From 533e5120806aed8f0af0b03a1d11e1da127f8574 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:26:22 -0400 Subject: [PATCH 033/185] Completed Flask Quickstart guide --- sqlite-cloud/_nav.ts | 5 +- sqlite-cloud/quick-start-flask.mdx | 80 ++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 sqlite-cloud/quick-start-flask.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index c72f960..41373f5 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -11,8 +11,9 @@ const sidebarNav: SidebarNavStruct = [ { title: "Quick Start Guides", type: "inner", level: 0 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - // { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, - // { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-flask.mdx b/sqlite-cloud/quick-start-flask.mdx new file mode 100644 index 0000000..801ed53 --- /dev/null +++ b/sqlite-cloud/quick-start-flask.mdx @@ -0,0 +1,80 @@ +--- +title: Flask Quick Start Guide +description: Get started with SQLite Cloud using Flask. +category: getting-started +status: publish +slug: quick-start-flask +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Flask by building a simple application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a Flask app** + - You should have the latest Python version (3) installed locally. + +```bash +mkdir sqlc-quickstart +cd sqlc-quickstart + +python3 -m venv .venv +. .venv/bin/activate + +pip install flask +``` + +3. **Install the SQLite Cloud SDK** + +```bash +pip install sqlitecloud +``` + +4. **Query data** + - Copy the following code into a new `app.py` file. + - In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and replace `` below. + +```py +from flask import Flask +import sqlitecloud + +app = Flask(__name__) + +@app.route('/') +def get_albums(): + conn = sqlitecloud.connect('') + + db_name = 'chinook.sqlite' + db_query = "SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20" + + conn.execute(f"USE DATABASE {db_name}") + + cursor = conn.execute(db_query) + + conn.close() + + result = '

    Albums

    ' + + for row in cursor: + album = f"{row[1]} by {row[2]}" + result += f"
  • {album}
  • " + + return result + '
    ' +``` + +5. **Run your app** + - If you're using port 5000 or on MacOS, also pass the `--port` option to provdie an open port. + - Pass the --debug option to enable hot reloading and interactive debugging on your dev server. + +```bash +flask run --port 3000 --debug +``` + +6. **View your app** + - Open your browser and navigate to `http://127.0.0.1:3000/` to see your app data. + - If you're unfamiliar with Flask, the code above calls the `get_albums` function when you load the root URL. The function returns a string with HTML for the browser to render. + +And that's it! You've successfully built a Flask app that reads data from a SQLite Cloud database. From 8d3f1f15e24cc43e19b410cf934b704ddd30b596 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:29:34 -0400 Subject: [PATCH 034/185] Completed Django Quickstart guide --- sqlite-cloud/_nav.ts | 4 +- sqlite-cloud/quick-start-django.mdx | 140 ++++++++++++++++++++++------ 2 files changed, 111 insertions(+), 33 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index c72f960..ce6f75b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -11,8 +11,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "Quick Start Guides", type: "inner", level: 0 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - // { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, - // { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quick-start-django.mdx index 5c4beaf..1b627af 100644 --- a/sqlite-cloud/quick-start-django.mdx +++ b/sqlite-cloud/quick-start-django.mdx @@ -6,72 +6,150 @@ status: publish slug: quick-start-django --- -In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database, and returns the result to a lightweight client. +In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database. 1. **Set up a SQLite Cloud account** - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Django app** - - Create a Django app using the following command: + - If you haven't already done so, [install Python and Django](https://docs.djangoproject.com/en/5.0/intro/install/). + - The following command creates an outer directory (the container for your project) AND an inner directory (the Python package for your project). Both directories will be named `sqlitecloud_quickstart`. + ```bash django-admin startproject sqlitecloud_quickstart ``` - - Create a new app within the project: + - The following command creates your app as a separate package within the project container directory. + ```bash cd sqlitecloud_quickstart -python manage.py startapp quickstart +python manage.py startapp albums ``` -3. **Install the SQLite Cloud SDK** +3. **Install the SQLite Cloud Python SDK** + - Run this command from your current directory (i.e. the outer `sqlitecloud_quickstart`). + ```bash pip install sqlitecloud ``` -4. **Query data** - - Grab a connection string by clicking on a node in your dashboard. - - Create a file `services.py` within the quickstart directory. Use the following code to display data from your database. +4. **App setup** + - Create a new file `albums/services.py` and copy in the following code. + - In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and replace `` below. ```python import sqlitecloud -# Create your models here. -db = sqlitecloud.connect('') - def get_albums(): - result = db.execute(''' - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20; - ''') - return result.fetchall() + conn = sqlitecloud.connect('') + + db_name = "chinook.sqlite" + db_query = "SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20" + + conn.execute(f"USE DATABASE {db_name}") + + cursor = conn.execute(db_query) + + conn.close() + + result = cursor.fetchall() + return result ``` - - Use the following code to display the data in a Django view: + + - Copy the following code into `albums/views.py`. This view function invokes the `get_albums()` function defined in `services.py` to connect to the database and return album and artist information. + - The view function converts each returned row from a list to an object to more easily access the information in our HTML template (will discuss further later). + ```python -from django.http import JsonResponse +from django.http import HttpResponse +from django.template import loader from .services import get_albums -def albums(request): - data = get_albums() - return JsonResponse(data, safe=False) +def index(request): + albumsList = get_albums() + + albumObjsList = [{'album': row[1], 'artist': row[2]} for row in albumsList] + + template = loader.get_template("albums/index.html") + context = { + "albumObjsList": albumObjsList, + } + return HttpResponse(template.render(context, request)) ``` - - Add the following URL pattern to your project's `urls.py` file: + + - Create a new file `albums/urls.py` and copy in the following code. This URL configuration (URLconf) maps the above view to a URL so we can access the view in the browser. + ```python from django.urls import path -from quickstart import albums +from . import views + +urlpatterns = [ + path("", views.index, name="index") +] +``` + + - Adjust the code in `sqlitecloud_quickstart/urls.py` to be as follows. We must configure this global URLconf in the inner `sqlitecloud_quickstart` to include the URLconf we defined above in our app. + +```python +from django.contrib import admin +from django.urls import include, path +# global URLconfs urlpatterns = [ - path('albums/', albums), + path("albums/", include("albums.urls")), + path('admin/', admin.site.urls), ] ``` - - Run the Django development server: + + - Now we'll create a Django template the view can use to render HTML. Under `albums`, create a new file at `templates/albums/index.html` and copy in the following code. + - Bear in mind, there are now 2 (outer and inner) `albums` directories. + - The `index` view function above is already set up to load and render the template `albums/index.html`. (NOTE: `albums` here is the inner `albums` dir.) + +```html +
    +

    Albums

    +
      + {% for row in albumObjsList %} +
    • {{ row.album }} by {{ row.artist }}
    • + {% endfor %} +
    +
    +``` + - Lastly, in `sqlitecloud_quickstart/settings.py`, configure `DIRS` in `TEMPLATES` as follows. + - `'APP_DIRS': True` tells Django's templating engine to look for template source files inside project apps. + - `DIRS` provides the filepath to the correct app's `templates` dir. + +```python +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': ['albums/templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] +``` + +5. **Run the Django dev server** + ```bash python manage.py runserver ``` - - Visit `http://localhost:8000/albums/` to see the data returned from your SQLite Cloud database. -And that's it! You've successfully built a Django app that reads data from a SQLite Cloud database. + - Visit `http://127.0.0.1:8000/albums/` to see your app data. + +6. **FOLLOW-UP:** +This Quickstart goes a bit deeper into the framework than the other Quickstarts since Django requires more boilerplate to get up-and-running with a simple app. + +If you're new to Django and want to learn more, we referenced the following Django Tutorial pages extensively when writing this Quickstart: + - [Part 1](https://docs.djangoproject.com/en/5.0/intro/tutorial01) + - [Part 3](https://docs.djangoproject.com/en/5.0/intro/tutorial03) + +And that's it! You've successfully built a Django app that reads data from a SQLite Cloud database. \ No newline at end of file From 4442492b9537edd53ab8e5a208c52320d0d4d841 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sun, 14 Jul 2024 11:26:29 +0000 Subject: [PATCH 035/185] add issue template --- .github/ISSUE_TEMPLATE/UPDATE.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/UPDATE.md diff --git a/.github/ISSUE_TEMPLATE/UPDATE.md b/.github/ISSUE_TEMPLATE/UPDATE.md new file mode 100644 index 0000000..f24987a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/UPDATE.md @@ -0,0 +1,31 @@ +--- +name: Documentation Update +about: Suggest updates, additions, or improvements to the documentation +title: '[Update] ' +labels: 'documentation' +assignees: '' +--- + +## Documentation Area +*Indicate the area of the documentation that needs updating (e.g., API reference, user guide, tutorials, etc.).* + +### Current Documentation Link +*Provide a link to the current documentation that needs updating (if applicable).* + +[Link to the current documentation] + +## Description of Changes +*Describe the changes you would like to see in the documentation.* + +## Rationale +*Explain why these changes are necessary or how they improve the documentation.* + +## Examples and Code Snippets +*Include any examples or code snippets that should be added to the documentation.* + +### Example 1 + +### Example 2 + +## Additional Context and Relevant Repos +*Provide any additional context or information that will help in making the necessary updates.* From e3846195bd53b8c84b51d1bc80d3db2c14dddd94 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sun, 14 Jul 2024 05:28:23 -0700 Subject: [PATCH 036/185] update --- sqlite-cloud/_nav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index ce6f75b..1b8e574 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -11,7 +11,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Quick Start Guides", type: "inner", level: 0 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "sqlite-cloud/quick-start-react-native", type: "inner", level: 1 }, + { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, From 55d496713b4998ec8cab44745c2271b9e223d157 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sun, 14 Jul 2024 05:40:09 -0700 Subject: [PATCH 037/185] Update UPDATE.md --- .github/ISSUE_TEMPLATE/UPDATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/UPDATE.md b/.github/ISSUE_TEMPLATE/UPDATE.md index f24987a..c131553 100644 --- a/.github/ISSUE_TEMPLATE/UPDATE.md +++ b/.github/ISSUE_TEMPLATE/UPDATE.md @@ -1,7 +1,7 @@ --- name: Documentation Update about: Suggest updates, additions, or improvements to the documentation -title: '[Update] ' +title: '[Docs Update] ' labels: 'documentation' assignees: '' --- From 5cddfe6d59a91821c9a1c824f936da86ef4bbf4b Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sun, 14 Jul 2024 05:48:30 -0700 Subject: [PATCH 038/185] fix: add weblite --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/platform/weblite.mdx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 sqlite-cloud/platform/weblite.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index a463809..9307283 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -25,6 +25,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Backups", filePath: "backups", type: "inner", level: 0 }, { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, // { title: "Storage", type: "inner", level: 0 }, // { title: "Partitioning", type: "inner", level: 0 }, { title: "Settings", filePath: "settings", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/weblite.mdx b/sqlite-cloud/platform/weblite.mdx new file mode 100644 index 0000000..a751c2a --- /dev/null +++ b/sqlite-cloud/platform/weblite.mdx @@ -0,0 +1,21 @@ +--- +title: Weblite +description: With Weblite, adding robust database capabilities to your site is as simple as adding Google Analytics. +category: platform +status: publish +slug: weblite +--- + +Weblite consists of an autogenerated HTTP/JSON REST API for programmatically interacting with SQLite Cloud. + +It is the simplest way to add a robust database backend to your application. + +## Overview +first, navigate to the Weblite panel from the left-hand navigation menu. + +From here, you'll find a list of APIs you can use to interact with your SQLite Cloud instance, including: +- **Services**: Endpoints for health checks, metrics, and more. +- **Weblite**: Endpoints for executing SQLiteCloudArrayType, and interacting with datbases and tables. +- **Functions**: Endpoints for executing SQLite functions. +- **Webhooks**: Endpoints for creating and managing webhooks. +- **Files**: Endpoints for uploading and downloading files. From 1583978761d5e5c7fd5e343b8460a6cc77970741 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sun, 14 Jul 2024 18:44:01 -0700 Subject: [PATCH 039/185] Update weblite.mdx --- sqlite-cloud/platform/weblite.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/weblite.mdx b/sqlite-cloud/platform/weblite.mdx index a751c2a..d6f154b 100644 --- a/sqlite-cloud/platform/weblite.mdx +++ b/sqlite-cloud/platform/weblite.mdx @@ -11,7 +11,7 @@ Weblite consists of an autogenerated HTTP/JSON REST API for programmatically int It is the simplest way to add a robust database backend to your application. ## Overview -first, navigate to the Weblite panel from the left-hand navigation menu. +First, navigate to the Weblite panel from the left-hand navigation menu. From here, you'll find a list of APIs you can use to interact with your SQLite Cloud instance, including: - **Services**: Endpoints for health checks, metrics, and more. From 78416185030b2a33d2ded137ec44660f620f03fc Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:39:41 -0700 Subject: [PATCH 040/185] add back classes and interfaces for js --- sqlite-cloud/_nav.ts | 17 ++++++++++++++++- sqlite-cloud/quick-start-prisma.mdx | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 5b1d53b..31d6e83 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -131,7 +131,22 @@ const sidebarNav: SidebarNavStruct = [ { title: "JavaScript", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/js/getting-started", level: 1 }, - { title: "React", ref: "/docs/sqlite-cloud/quick-start-react", type: "inner", level: 1 }, + { title: "Quick Starts", type: "inner", level: 1 }, + { title: "React", ref: "/docs/sqlite-cloud/quick-start-react", type: "inner", level: 2 }, + { title: "Node.js", ref: "/docs/sqlite-cloud/quick-start-node", type: "inner", level: 2 }, + { title: "Next.js", ref: "/docs/sqlite-cloud/quick-start-next", type: "inner", level: 2 }, + { title: "Classes", type: "inner", level: 1 }, + { title: "Database", filePath: 'sdks/js/classes/Database', type: "inner", level: 2 }, + { title: "SQLiteCloudConnection", filePath: 'sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, + { title: "SQLiteCloudError", filePath: 'sdks/js/classes/SQLiteCloudError', type: "inner", level: 2 }, + { title: "SQLiteCloudRow", filePath: 'sdks/js/classes/SQLiteCloudRow', type: "inner", level: 2 }, + { title: "SQLiteCloudRowset", filePath: 'sdks/js/classes/SQLiteCloudRowset', type: "inner", level: 2 }, + { title: "SQLiteCloudStatement", filePath: 'sdks/js/classes/Statement', type: "inner", level: 2 }, + + { title: 'Interfaces', type: "inner", level: 1 }, + { title: "SQLCloudRowsetMetadata", filePath: 'sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, + { title: "SQLiteCloudConfig", filePath: 'sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, + { title: "Python", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, diff --git a/sqlite-cloud/quick-start-prisma.mdx b/sqlite-cloud/quick-start-prisma.mdx index f773352..059ece2 100644 --- a/sqlite-cloud/quick-start-prisma.mdx +++ b/sqlite-cloud/quick-start-prisma.mdx @@ -2,7 +2,7 @@ title: Prisma Quick Start Guide description: Get started with SQLite Cloud using Prisma ORM. category: getting-started -status: publish +status: draft slug: quick-start-prisma --- From cf4d81e788e9e0101063579bc8a6eb53ed95a7b1 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:40:10 -0700 Subject: [PATCH 041/185] add modules --- sqlite-cloud/_nav.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 31d6e83..e9dad18 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -146,6 +146,7 @@ const sidebarNav: SidebarNavStruct = [ { title: 'Interfaces', type: "inner", level: 1 }, { title: "SQLCloudRowsetMetadata", filePath: 'sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, { title: "SQLiteCloudConfig", filePath: 'sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, + { title: "Modules", filePath: "sdks/js/modules", type: "inner", level: 1 }, { title: "Python", type: "inner", level: 0 }, From 9374d26d481c9ce31c8544c8adb95f62925b9860 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:43:32 -0700 Subject: [PATCH 042/185] update --- sqlite-cloud/_nav.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index e9dad18..269491d 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -130,11 +130,11 @@ const sidebarNav: SidebarNavStruct = [ { filePath: 'sqlite-cloud/sdks/c/SQCloudDownloadDatabase', type: "inner", level: 2 }, { title: "JavaScript", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sqlite-cloud/sdks/js/getting-started", level: 1 }, + { title: 'Introduction', type: "inner", filePath: "sdk-js-introduction", level: 1 }, { title: "Quick Starts", type: "inner", level: 1 }, - { title: "React", ref: "/docs/sqlite-cloud/quick-start-react", type: "inner", level: 2 }, - { title: "Node.js", ref: "/docs/sqlite-cloud/quick-start-node", type: "inner", level: 2 }, - { title: "Next.js", ref: "/docs/sqlite-cloud/quick-start-next", type: "inner", level: 2 }, + { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, + { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, + { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, { title: "Classes", type: "inner", level: 1 }, { title: "Database", filePath: 'sdks/js/classes/Database', type: "inner", level: 2 }, { title: "SQLiteCloudConnection", filePath: 'sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, From e59b5e2f258f1e7ef3a6759ea92c6a2871b1e682 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:44:47 -0700 Subject: [PATCH 043/185] update filepath string --- sqlite-cloud/_nav.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 269491d..a4c7176 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -136,17 +136,17 @@ const sidebarNav: SidebarNavStruct = [ { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, { title: "Classes", type: "inner", level: 1 }, - { title: "Database", filePath: 'sdks/js/classes/Database', type: "inner", level: 2 }, - { title: "SQLiteCloudConnection", filePath: 'sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, - { title: "SQLiteCloudError", filePath: 'sdks/js/classes/SQLiteCloudError', type: "inner", level: 2 }, - { title: "SQLiteCloudRow", filePath: 'sdks/js/classes/SQLiteCloudRow', type: "inner", level: 2 }, - { title: "SQLiteCloudRowset", filePath: 'sdks/js/classes/SQLiteCloudRowset', type: "inner", level: 2 }, - { title: "SQLiteCloudStatement", filePath: 'sdks/js/classes/Statement', type: "inner", level: 2 }, + { title: "Database", filePath: 'sqlite-cloud/sdks/js/classes/Database', type: "inner", level: 2 }, + { title: "SQLiteCloudConnection", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, + { title: "SQLiteCloudError", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudError', type: "inner", level: 2 }, + { title: "SQLiteCloudRow", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRow', type: "inner", level: 2 }, + { title: "SQLiteCloudRowset", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRowset', type: "inner", level: 2 }, + { title: "SQLiteCloudStatement", filePath: 'sqlite-cloud/sdks/js/classes/Statement', type: "inner", level: 2 }, { title: 'Interfaces', type: "inner", level: 1 }, - { title: "SQLCloudRowsetMetadata", filePath: 'sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, - { title: "SQLiteCloudConfig", filePath: 'sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, - { title: "Modules", filePath: "sdks/js/modules", type: "inner", level: 1 }, + { title: "SQLCloudRowsetMetadata", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, + { title: "SQLiteCloudConfig", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, + { title: "Modules", filePath: "sqlite-cloud/sdks/js/modules", type: "inner", level: 1 }, { title: "Python", type: "inner", level: 0 }, From f3ae943ada709d8e332579a791992ea029a2d778 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:46:35 -0700 Subject: [PATCH 044/185] fix --- sqlite-cloud/sdks/js/introduction.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sdks/js/introduction.mdx b/sqlite-cloud/sdks/js/introduction.mdx index ce94650..3f6b7a4 100644 --- a/sqlite-cloud/sdks/js/introduction.mdx +++ b/sqlite-cloud/sdks/js/introduction.mdx @@ -32,7 +32,7 @@ let results = await database.sql`SELECT * FROM tracks WHERE name = ${name}` // => returns [{ AlbumId: 1, Name: 'Breaking The Rules', Composer: 'Angus Young... }] ``` -Use [Database.sql](/docs/sdks/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. +Use [Database.sql](/docs/sqlite-cloud/sdks/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. We aim for full compatibility with the established [sqlite3 API](https://www.npmjs.com/package/sqlite3), with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlitecloud.io) while continuing to use your existing codebase. From f4f9df7515c90123f055764b4d59eeb9680e8041 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:47:46 -0700 Subject: [PATCH 045/185] update --- sqlite-cloud/_nav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index a4c7176..863601a 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -146,7 +146,7 @@ const sidebarNav: SidebarNavStruct = [ { title: 'Interfaces', type: "inner", level: 1 }, { title: "SQLCloudRowsetMetadata", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, { title: "SQLiteCloudConfig", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, - { title: "Modules", filePath: "sqlite-cloud/sdks/js/modules", type: "inner", level: 1 }, + { title: "Modules", filePath: "sdk-js-modules", type: "inner", level: 1 }, { title: "Python", type: "inner", level: 0 }, From 34a67147b8c73c899414b7200323cd8d5286ba07 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:48:37 -0700 Subject: [PATCH 046/185] test database link --- sqlite-cloud/sdks/js/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 99f659d..39bcf89 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -11,7 +11,7 @@ slug: sdk-js-modules ### Classes -- [Database](classes/database) +- [Database](docs/sqlite-cloud/sdks/js/database) - [SQLiteCloudConnection](classes/sqlitecloudconnection) - [SQLiteCloudError](classes/sqliteclouderror) - [SQLiteCloudRow](classes/sqlitecloudrow) From 332cdbdc71f9b8da88bd499c50f83ac1bc678865 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:49:08 -0700 Subject: [PATCH 047/185] update link --- sqlite-cloud/sdks/js/modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 39bcf89..9a60ac2 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -11,7 +11,7 @@ slug: sdk-js-modules ### Classes -- [Database](docs/sqlite-cloud/sdks/js/database) +- [Database](sqlite-cloud/sdks/js/database) - [SQLiteCloudConnection](classes/sqlitecloudconnection) - [SQLiteCloudError](classes/sqliteclouderror) - [SQLiteCloudRow](classes/sqlitecloudrow) From 5ec154628638a02511cd5bdb27adefba8b831f07 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 10:50:04 -0700 Subject: [PATCH 048/185] update links in module --- sqlite-cloud/sdks/js/modules.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 9a60ac2..07e006e 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -11,17 +11,17 @@ slug: sdk-js-modules ### Classes -- [Database](sqlite-cloud/sdks/js/database) -- [SQLiteCloudConnection](classes/sqlitecloudconnection) -- [SQLiteCloudError](classes/sqliteclouderror) -- [SQLiteCloudRow](classes/sqlitecloudrow) -- [SQLiteCloudRowset](classes/sqlitecloudrowset) -- [Statement](classes/statement) +- [Database](sqlite-cloud/sdks/js/classes/database) +- [SQLiteCloudConnection](sqlite-cloud/sdks/js/classes/sqlitecloudconnection) +- [SQLiteCloudError](sqlite-cloud/sdks/js/classes/sqliteclouderror) +- [SQLiteCloudRow](sqlite-cloud/sdks/js/classes/sqlitecloudrow) +- [SQLiteCloudRowset](sqlite-cloud/sdks/js/classes/sqlitecloudrowset) +- [Statement](sqlite-cloud/sdks/js/classes/statement) ### Interfaces -- [SQLCloudRowsetMetadata](interfaces/sqlcloudrowsetmetadata) -- [SQLiteCloudConfig](interfaces/sqlitecloudconfig) +- [SQLCloudRowsetMetadata](sqlite-cloud/sdks/js/interfaces/sqlcloudrowsetmetadata) +- [SQLiteCloudConfig](sqlite-cloud/sdks/js/interfaces/sqlitecloudconfig) ### Type Aliases From 0152b81631ddd1253be14afcef135ddba39b23b5 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 11:00:31 -0700 Subject: [PATCH 049/185] update --- sqlite-cloud/platform/pub-sub.mdx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/pub-sub.mdx b/sqlite-cloud/platform/pub-sub.mdx index 71744c8..4ab5982 100644 --- a/sqlite-cloud/platform/pub-sub.mdx +++ b/sqlite-cloud/platform/pub-sub.mdx @@ -139,4 +139,28 @@ OK "col2": "test101" }] } -``` \ No newline at end of file +``` + +## Client Library Examples + +```javascript +import { Database } from '@sqlitecloud/drivers' +import { PubSub, PUBSUB_ENTITY_TYPE } from '@sqlitecloud/drivers/lib/drivers/pubsub' + +let database = new Database('sqlitecloud://user:password@xxx.sqlite.cloud:8860/chinook.sqlite') +// or use sqlitecloud://xxx.sqlite.cloud:8860?apikey=xxxxxxx + +const pubSub: PubSub = await database.getPubSub() + +await pubSub.listen(PUBSUB_ENTITY_TYPE.TABLE, 'albums', (error, results, data) => { + if (results) { + // Changes on albums table will be received here as JSON object + console.log('Received message:', results) + } +}) + +await database.sql`INSERT INTO albums (Title, ArtistId) values ('Brand new song', 1)` + +// Stop listening changes on the table +await pubSub.unlisten(PUBSUB_ENTITY_TYPE.TABLE, 'albums') +``` From fe81702b2034423ac19d55944f3c93ccab014dde Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 15 Jul 2024 12:16:13 -0700 Subject: [PATCH 050/185] add python quickstarts (#67) --- sqlite-cloud/_nav.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 863601a..1e75071 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -151,6 +151,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "Python", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, + { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, + { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, { title: "Go", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-go-introduction", level: 1 }, From 241a2fd20967853a2cb15be037fe0f0f25a71490 Mon Sep 17 00:00:00 2001 From: Caheri Date: Tue, 16 Jul 2024 16:01:50 -0500 Subject: [PATCH 051/185] fixed path for broken c links --- sqlite-cloud/sdks/c/SQCloudArrayCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayValue.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobRead.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConfig.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConnect.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudDisconnect.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudError.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudExec.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudExecArray.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudResultDouble.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultDump.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultFloat.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultInt32.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudResultInt64.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudUUID.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMBind.mdx | 6 +++--- sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMChanges.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMColumn.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMCompile.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMResult.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMStep.mdx | 4 ++-- sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx | 2 +- 57 files changed, 87 insertions(+), 87 deletions(-) diff --git a/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx b/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx index d0b7c17..37dfdf3 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayCount.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudArrayCount (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the number of items in the SQCloudResult array. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the number of items in the SQCloudResult array. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx index c71b8b2..91300cd 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayDoubleValue.mdx @@ -10,11 +10,11 @@ double SQCloudArrayDoubleValue (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a double value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a double value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) ### Return value An `double` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx index 6f60f78..0b0314a 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayFloatValue.mdx @@ -10,11 +10,11 @@ float SQCloudArrayFloatValue (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a float value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a float value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) ### Return value A `float` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx b/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx index 486c607..30beeb9 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayInt32Value.mdx @@ -10,11 +10,11 @@ int32_t SQCloudArrayInt32Value (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int32 value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int32 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) ### Return value An `int32_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx b/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx index cf809f0..e8f3c79 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayInt64Value.mdx @@ -10,11 +10,11 @@ int64_t SQCloudArrayInt64Value (SQCloudResult *result, uint32_t index); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int64 value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve an Int64 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) ### Return value An `int64_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx b/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx index 174e57c..875b525 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayValue.mdx @@ -10,11 +10,11 @@ char *SQCloudArrayValue (SQCloudResult *result, uint32_t index, uint32_t *len); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a pointer and a length for an array value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve a pointer and a length for an array value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) * **len**: On output the length of the returned buffer ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx b/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx index 849bc6e..195f0a3 100644 --- a/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx +++ b/sqlite-cloud/sdks/c/SQCloudArrayValueType.mdx @@ -10,11 +10,11 @@ SQCLOUD_VALUE_TYPE SQCloudArrayValueType (SQCloudResult *result, uint32_t index) ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the type of each array item. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ARRAY then use this function to retrieve the type of each array item. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sdks/c/sqcloudarraycount)-1) +* **index**: An array index (from 0 to [SQCloudArrayCount](/docs/sqlite-cloud/sdks/c/sqcloudarraycount)-1) ### Return value An `int` represented by the SQCLOUD_VALUE_TYPE enum type: diff --git a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx index 9c318cd..4d174d2 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx @@ -16,7 +16,7 @@ The incremental blob I/O routines can only read or overwriting existing blob con This function resembles the [sqlite3_blob_bytes](https://www.sqlite.org/c3ref/blob_bytes.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) ### Return value An `int` value with the size in bytes of the BLOB. diff --git a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx index 0244506..8c6b023 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx @@ -13,7 +13,7 @@ bool SQCloudBlobClose (SQCloudBlob *blob); This function closes an open BLOB handle. The BLOB handle is closed unconditionally. Even if this routine returns an error code, the handle is still closed. This function resembles the [sqlite3_blob_close](https://www.sqlite.org/c3ref/blob_close.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) ### Return value `true` if operation succed, otherwise `false` diff --git a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx index e373e3d..eb4536c 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx @@ -25,7 +25,7 @@ This function fails if any of the following conditions are true: This function resembles the [sqlite3_blob_open](https://www.sqlite.org/c3ref/blob_open.html) SQLite API. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **dbname**: symbolic name of the database (usually `main`, if NULL `main` is used) * **tablename**: table name that contains the BLOB column * **colname**: name of the BLOB column diff --git a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx index 91f6195..9f17a4c 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx @@ -15,7 +15,7 @@ This function is used to move an existing BLOB handle so that it points to a dif This function resembles the [sqlite3_blob_reopen](https://www.sqlite.org/c3ref/blob_reopen.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) * **rowid**: rowid of the BLOB to open diff --git a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx index 3facf99..52f2627 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx @@ -15,7 +15,7 @@ The **SQCloudBlobRead** function is used to read data from an open BLOB handle i This function resembles the [sqlite3_blob_read](https://www.sqlite.org/c3ref/blob_read.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) * **buffer**: an user-supplied pre-allocated buffer * **blen**: the length of the input buffer * **offset**: the offset value set to where to start the read operation diff --git a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx index 745f0e5..e947e75 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx @@ -16,7 +16,7 @@ The **SQCloudBlobWrite** function is used to write data into an open BLOB handle This function resembles the [sqlite3_blob_write](https://www.sqlite.org/c3ref/blob_write.html) SQLite API. ### Parameters -* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sdks/c/sqcloudblobopen) +* **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) * **buffer**: an user-supplied pre-allocated buffer * **blen**: the length of the input buffer * **offset**: the offset value set to where to start the write operation diff --git a/sqlite-cloud/sdks/c/SQCloudConfig.mdx b/sqlite-cloud/sdks/c/SQCloudConfig.mdx index 01b836b..d49319c 100644 --- a/sqlite-cloud/sdks/c/SQCloudConfig.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConfig.mdx @@ -7,7 +7,7 @@ status: publish ### Description -The **SQCloudConfig** struct is used in the [SQCloudConnect](/docs/sdks/c/sqcloudconnect) and in the [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) functions to set connection specific configuration parameters. +The **SQCloudConfig** struct is used in the [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) and in the [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) functions to set connection specific configuration parameters. ### SQCloudConfig diff --git a/sqlite-cloud/sdks/c/SQCloudConnect.mdx b/sqlite-cloud/sdks/c/SQCloudConnect.mdx index 8dd2b9f..d144d64 100644 --- a/sqlite-cloud/sdks/c/SQCloudConnect.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConnect.mdx @@ -15,7 +15,7 @@ Initiate a new connection to a database node specified by hostname and port. Thi ### Parameters * **hostname**: a NULL terminated string that contains host name or host ip address * **port**: database server port (you can use the `SQCLOUD_DEFAULT_PORT` macro) -* **config**: a pointer to a [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig) (cannot be NULL) +* **config**: a pointer to a [SQCloudConfig struct](/docs/sqlite-cloud/sdks/c/sqcloudconfig) (cannot be NULL) ### Return value A pointer to an opaque **SQCloudConnection** struct. diff --git a/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx b/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx index 48e0f43..eb12181 100644 --- a/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx +++ b/sqlite-cloud/sdks/c/SQCloudConnectWithString.mdx @@ -34,11 +34,11 @@ Key(s) can be: * client_certificate * client_certificate_key -These key(s) are equivalent to the fields specified in the [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig). +These key(s) are equivalent to the fields specified in the [SQCloudConfig struct](/docs/sqlite-cloud/sdks/c/sqcloudconfig). ### Parameters * **s**: an URL encoded NULL terminated string that contains connection info -* **pconfig**: a pointer to a [SQCloudConfig struct](/docs/sdks/c/sqcloudconfig) (can be NULL) used to override configurations found in the connection string +* **pconfig**: a pointer to a [SQCloudConfig struct](/docs/sqlite-cloud/sdks/c/sqcloudconfig) (can be NULL) used to override configurations found in the connection string ### Return value A pointer to an opaque **SQCloudConnection** struct. diff --git a/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx b/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx index 1a3958b..87194b4 100644 --- a/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx +++ b/sqlite-cloud/sdks/c/SQCloudDisconnect.mdx @@ -13,7 +13,7 @@ void SQCloudDisconnect (SQCloudConnection *connection); Closes the connection to the server. Also frees memory used by the SQCloudConnection object. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) ### Return value Nothing. diff --git a/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx b/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx index 77760b1..3944308 100644 --- a/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx +++ b/sqlite-cloud/sdks/c/SQCloudDownloadDatabase.mdx @@ -14,7 +14,7 @@ bool SQCloudDownloadDatabase (SQCloudConnection *connection, const char *dbname, Initiate an SQLite database download from an already connected SQLite Cloud node. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **dbname**: the name of the database to download * **xdata**: a pointer to an opaque datatype that will be passed as-is to the callback * **xcallback**: callback that will be automatically called to read from the input database file diff --git a/sqlite-cloud/sdks/c/SQCloudError.mdx b/sqlite-cloud/sdks/c/SQCloudError.mdx index b6e2cea..a261548 100644 --- a/sqlite-cloud/sdks/c/SQCloudError.mdx +++ b/sqlite-cloud/sdks/c/SQCloudError.mdx @@ -20,7 +20,7 @@ These functions resemble the [sqlite3_error_*](https://www.sqlite.org/c3ref/errc ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) ### Return value * **SQLiteIsError** returns `true` if the most recent API call failed. diff --git a/sqlite-cloud/sdks/c/SQCloudExec.mdx b/sqlite-cloud/sdks/c/SQCloudExec.mdx index 048ae76..66470b6 100644 --- a/sqlite-cloud/sdks/c/SQCloudExec.mdx +++ b/sqlite-cloud/sdks/c/SQCloudExec.mdx @@ -13,11 +13,11 @@ SQCloudResult *SQCloudExec (SQCloudConnection *connection, const char *command); Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **command**: a NULL terminated string with the command to execute (multiple commands can be sent if separated by the semicolon character) ### Return value -A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdks/c/sqcloudresultfree) +A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sqlite-cloud/sdks/c/sqcloudresultfree) ### Example ```c diff --git a/sqlite-cloud/sdks/c/SQCloudExecArray.mdx b/sqlite-cloud/sdks/c/SQCloudExecArray.mdx index ffdc3d9..ad4dcb8 100644 --- a/sqlite-cloud/sdks/c/SQCloudExecArray.mdx +++ b/sqlite-cloud/sdks/c/SQCloudExecArray.mdx @@ -10,10 +10,10 @@ SQCloudResult *SQCloudExecArray (SQCloudConnection *connection, const char *comm ``` ### Description -Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). This function is equivalent to the [SQCloudExec](/docs/sdks/c/sqcloudexec) function but special placeholders can be used to bind values to the statement (most of the time avoiding the need to perform copies and to encode data). +Submits a command to the server and waits for the result. The command can be any SQLite statement or any built-in [SQLite Cloud command](/docs/commands). This function is equivalent to the [SQCloudExec](/docs/sqlite-cloud/sdks/c/sqcloudexec) function but special placeholders can be used to bind values to the statement (most of the time avoiding the need to perform copies and to encode data). ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **command**: a NULL terminated string with the command to execute * **values**: an array of n values * **len**: an array of n length @@ -21,7 +21,7 @@ Submits a command to the server and waits for the result. The command can be any * **n** number of array elements ### Return value -A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sdks/c/sqcloudresultfree) +A pointer to an opaque **SQCloudResult** struct that must be explicitly deallocated with [SQCloudResultFree](/docs/sqlite-cloud/sdks/c/sqcloudresultfree) ### Example ```c diff --git a/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx b/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx index 61950a2..06e8859 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultDouble.mdx @@ -10,7 +10,7 @@ double SQCloudResultDouble (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Double value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Double value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultDump.mdx b/sqlite-cloud/sdks/c/SQCloudResultDump.mdx index d972b29..c78ef36 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultDump.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultDump.mdx @@ -13,7 +13,7 @@ void SQCloudResultDump (SQCloudConnection *connection, SQCloudResult *result); Print the result on standard output. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **result**: A valid SQCloudResult pointer returned by an SQCloud function. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx b/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx index b7bf297..e958871 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultFloat.mdx @@ -10,7 +10,7 @@ float SQCloudResultFloat (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Float value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_FLOAT then use this function to retrieve a Float value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx b/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx index 72d1682..966ccca 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultInt32.mdx @@ -10,7 +10,7 @@ int32_t SQCloudResultInt32 (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int32 value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int32 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx b/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx index fec15a0..dfab2b8 100644 --- a/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx +++ b/sqlite-cloud/sdks/c/SQCloudResultInt64.mdx @@ -10,7 +10,7 @@ int64_t SQCloudResultInt64 (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int64 value. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_INTEGER then use this function to retrieve an Int64 value. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx index 10fb855..e8e1974 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetCols.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudRowsetCols (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of columns in the Rowset. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of columns in the Rowset. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx index 209f16c..2792b25 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetColumnName.mdx @@ -10,11 +10,11 @@ char *SQCloudRowsetColumnName (SQCloudResult *result, uint32_t col, uint32_t *le ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the name of a column. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the name of a column. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) * **len**: On output the column name length ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx index c8f9c38..df3f89c 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue.mdx @@ -10,12 +10,12 @@ double SQCloudRowsetDoubleValue (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Double value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Double value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) ### Return value A `double` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx index 967528b..fcbbbcc 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetFloatValue.mdx @@ -10,12 +10,12 @@ float SQCloudRowsetFloatValue (SQCloudResult *result, uint32_t row, uint32_t col ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Float value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the Float value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) ### Return value A `float` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx index e5f8b25..5714c6d 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetInt32Value.mdx @@ -10,12 +10,12 @@ int32_t SQCloudRowsetInt32Value (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int32_t` value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int32_t` value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int32_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx index 2e954b6..9808f14 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetInt64Value.mdx @@ -10,12 +10,12 @@ int64_t SQCloudRowsetInt64Value (SQCloudResult *result, uint32_t row, uint32_t c ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int64_t` value of the item at row/col. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the `int64_t` value of the item at row/col. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int64_t` value. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx index a3e8835..386d711 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetRows.mdx @@ -10,7 +10,7 @@ uint32_t SQCloudRowsetRows (SQCloudResult *result); ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of rows in the Rowset. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the number of rows in the Rowset. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx index cc2ed68..06a7b64 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx @@ -10,12 +10,12 @@ char *SQCloudRowsetValue (SQCloudResult *result, uint32_t row, uint32_t col, uin ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve a pointer and a length for a rowset item identified by a given row and column index. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve a pointer and a length for a rowset item identified by a given row and column index. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) * **len**: On output the length of the returned buffer ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx index 3c2021b..33b4427 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetValueType.mdx @@ -10,12 +10,12 @@ SQCLOUD_VALUE_TYPE SQCloudRowsetValueType (SQCloudResult *result, uint32_t row, ``` ### Description -If the result of the function [SQCloudResultType](/docs/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the type of each rowset item identified by a given row and column index. +If the result of the function [SQCloudResultType](/docs/sqlite-cloud/sdks/c/sqcloudresulttype) is RESULT_ROWSET then use this function to retrieve the type of each rowset item identified by a given row and column index. ### Parameters * **result**: A valid SQCloudResult pointer returned by an SQCloud function. -* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sdks/c/sqcloudrowsetrows)-1) -* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sdks/c/sqcloudrowsetcols)-1) +* **row**: A row index (from 0 to [SQCloudRowsetRows](/docs/sqlite-cloud/sdks/c/sqcloudrowsetrows)-1) +* **col**: A column index (from 0 to [SQCloudRowsetCols](/docs/sqlite-cloud/sdks/c/sqcloudrowsetcols)-1) ### Return value An `int` represented by the SQCLOUD_VALUE_TYPE enum type: diff --git a/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx b/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx index 1dbd661..77c3331 100644 --- a/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx +++ b/sqlite-cloud/sdks/c/SQCloudSetPubSubCallback.mdx @@ -14,7 +14,7 @@ By using **SQCloudSetPubSubCallback**, you can set a callback function that will ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **callback**: the C callback to be called in each notification * **data**: custom data to be transparently passed to the callback diff --git a/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx b/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx index a9219d9..e38c296 100644 --- a/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx +++ b/sqlite-cloud/sdks/c/SQCloudSetPubSubOnly.mdx @@ -10,10 +10,10 @@ SQCloudResult *SQCloudSetPubSubOnly (SQCloudConnection *connection); ``` ### Description -When Pub/Sub is activated (after calling [SQCloudSetPubSubCallback](/docs/sdks/c/sqcloudsetpubsubcallback)) there are two sockets associated to the SQCloudConnection connection. The **SQCloudSetPubSubOnly** function closes the **main** socket, leaving the **pub/sub** socket opened and ready to receive incoming notifications from subscripted channels and tables. +When Pub/Sub is activated (after calling [SQCloudSetPubSubCallback](/docs/sqlite-cloud/sdks/c/sqcloudsetpubsubcallback)) there are two sockets associated to the SQCloudConnection connection. The **SQCloudSetPubSubOnly** function closes the **main** socket, leaving the **pub/sub** socket opened and ready to receive incoming notifications from subscripted channels and tables. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) ### Return value An OK result is succesfully executed, otherwise an error. diff --git a/sqlite-cloud/sdks/c/SQCloudUUID.mdx b/sqlite-cloud/sdks/c/SQCloudUUID.mdx index 27c2e3e..047d7af 100644 --- a/sqlite-cloud/sdks/c/SQCloudUUID.mdx +++ b/sqlite-cloud/sdks/c/SQCloudUUID.mdx @@ -13,7 +13,7 @@ const char *SQCloudUUID (SQCloudConnection *connection); The **SQCloudUUID** function returns the unique client UUID value. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) ### Return value A NULL terminated string that contains the unique client UUID value. diff --git a/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx b/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx index 676fa76..e3ad9e3 100644 --- a/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx +++ b/sqlite-cloud/sdks/c/SQCloudUploadDatabase.mdx @@ -14,7 +14,7 @@ bool SQCloudUploadDatabase (SQCloudConnection *connection, const char *dbname, c Initiate an SQLite database upload to an already connected SQLite Cloud node. ### Parameters -* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **dbname**: the name of the database on server-side once uploaded will be completed * **key**: encryption database key (if any) * **xdata**: a pointer to an opaque datatype that will be passed as-is to the callback diff --git a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx index 24c9c16..9f2667b 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx @@ -17,7 +17,7 @@ bool SQCloudVMBindZeroBlob (SQCloudVM *vm, int index, int64_t len); ### Description Bind a value to a compiled SQL statement. -In the SQL statement text input to [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile), literals may be replaced by a parameter that matches one of following templates: +In the SQL statement text input to [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile), literals may be replaced by a parameter that matches one of following templates: * ? * ?NNN * :VVV @@ -29,8 +29,8 @@ These functions resemble the [sqlite3_bind_*](https://www.sqlite.org/c3ref/bind_ ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). -* **index**: Represents the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1. When the same named SQL parameter is used more than once, second and subsequent occurrences have the same index as the first occurrence. The index for named parameters can be looked up using the [SQCloudVMBindParameterIndex](/docs/sdks/c/sqcloudvmbindparameterindex) API if desired. The index for "?NNN" parameters is the value of NNN. +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). +* **index**: Represents the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1. When the same named SQL parameter is used more than once, second and subsequent occurrences have the same index as the first occurrence. The index for named parameters can be looked up using the [SQCloudVMBindParameterIndex](/docs/sqlite-cloud/sdks/c/sqcloudvmbindparameterindex) API if desired. The index for "?NNN" parameters is the value of NNN. * **value**: The the value to bind to the parameter. * **len**: The number of bytes in the parameter. To be clear: the value is the number of bytes in the value, not the number of characters. diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx index c4d4f61..00f7374 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx @@ -15,7 +15,7 @@ This routine can be used to find the number of SQL parameters in a prepared stat This function resembles the [bind_parameter_count](https://www.sqlite.org/c3ref/bind_parameter_count.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx index 8fd32cf..2b16c71 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx @@ -10,12 +10,12 @@ int SQCloudVMBindParameterIndex (SQCloudVM *vm, const char *name); ``` ### Description -Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to [SQCloudVMBind](/docs/sdks/c/sqcloudvmbind). A zero is returned if no matching parameter is found. +Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to [SQCloudVMBind](/docs/sqlite-cloud/sdks/c/sqcloudvmbind). A zero is returned if no matching parameter is found. This function resembles the [bind_parameter_index](https://www.sqlite.org/c3ref/bind_parameter_index.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). * **name**: The SQL parameter name. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx index 59bac7c..f595bf7 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx @@ -18,7 +18,7 @@ If the value of index is out of range or if the N-th parameter is nameless, then This function resembles the [bind_parameter_name](https://www.sqlite.org/c3ref/bind_parameter_name.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). * **index**: The SQL parameter index. ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx b/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx index 2701188..9d7672b 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMChanges.mdx @@ -18,7 +18,7 @@ If you need to get the changes from a SQCloudConnection object you can send a `D ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx index 6e88a37..4d9f2ac 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx @@ -15,7 +15,7 @@ This function resembles the [sqlite3_finalize](https://www.sqlite.org/c3ref/fina ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx index 823434f..093f460 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx @@ -21,8 +21,8 @@ These functions resemble the [sqlite3_column_*](https://www.sqlite.org/c3ref/col ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). -* **index**: The index of the column for which information should be returned. The leftmost column of the result set has the index 0. The number of columns in the result can be determined using [SQCloudVMColumnCount](/docs/sdks/c/sqcloudvmcolumncount). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). +* **index**: The index of the column for which information should be returned. The leftmost column of the result set has the index 0. The number of columns in the result can be determined using [SQCloudVMColumnCount](/docs/sqlite-cloud/sdks/c/sqcloudvmcolumncount). * **len**: The number of bytes of the returned value. The **SQCloudVMColumnType** routine returns the datatype code for the initial data type of the result column. The returned value is one of following: diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx index 1be9cc8..1bf7c60 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx @@ -16,7 +16,7 @@ This function resembles the [sqlite3_column_count](https://sqlite.org/c3ref/colu ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). Return value An `int` with the number of columns. diff --git a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx index e74f695..12f1887 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx @@ -14,7 +14,7 @@ Compile an SQL statement into a byte-code virtual machine. This function resembles the [sqlite3_prepare](https://www.sqlite.org/c3ref/prepare.html) SQLite API. ### Parameters -* **connection**: A valid connection object obtained by [SQCloudConnect](/docs/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sdks/c/sqcloudconnectwithstring) +* **connection**: A valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) * **sql**: The statement to be compiled. * **len**: If the len argument is negative, then sql is read up to the first zero terminator. If len is positive, then it is the number of bytes read from sql. * **tail**: If the tail argument is not NULL then *tail is made to point to the first byte past the end of the first SQL statement in sql. SQCloudVMCompile compiles only the first statement in sql, so *tail is left pointing to what remains uncompiled. diff --git a/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx b/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx index 6a8556b..4fff303 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMErrorCode.mdx @@ -14,7 +14,7 @@ Retrieve the latest error code (if any) from the associated vm. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx b/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx index f61a1e9..080e116 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMErrorMsg.mdx @@ -14,7 +14,7 @@ Retrieve the latest error message (if any) from the associated vm. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx index d279f85..208bebb 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx @@ -13,7 +13,7 @@ int SQCloudVMIsExplain (SQCloudVM *vm); The **SQCloudVMIsExplain** interface returns 1 if the prepared statement S is an EXPLAIN statement, or 2 if the statement S is an EXPLAIN QUERY PLAN. **SQCloudVMIsExplain** interface returns 0 if the statement is an ordinary statement or a NULL pointer. This function resembles the [sqlite3_stmt_isexplain](https://www.sqlite.org/c3ref/stmt_isexplain.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value An `int` value representing if the original statement was an EXPLAIN. diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx index 54e1a0e..d91c61c 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx @@ -10,11 +10,11 @@ bool SQCloudVMIsFinalized (SQCloudVM *vm); ``` ### Description -The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sdks/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the [sqlite3_stmt_busy](https://www.sqlite.org/c3ref/stmt_busy.html) SQLite API. +The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sqlite-cloud/sdks/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the [sqlite3_stmt_busy](https://www.sqlite.org/c3ref/stmt_busy.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx index 020a80c..6d2d7df 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx @@ -13,7 +13,7 @@ bool SQCloudVMIsReadOnly (SQCloudVM *vm); The **SQCloudVMIsReadOnly** interface returns true if and only if the prepared statement bound to vm makes no direct changes to the content of the database file. This routine returns false if there is any possibility that the statement might change the database file. A false return does not guarantee that the statement will change the database file. This function resembles the [sqlite3_stmt_readonly](https://www.sqlite.org/c3ref/stmt_readonly.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx b/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx index 52dc0a8..da5661d 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMLastRowID.mdx @@ -21,7 +21,7 @@ If you need to get the last inserted rowid from a SQCloudConnection object you c ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMResult.mdx b/sqlite-cloud/sdks/c/SQCloudVMResult.mdx index f250935..ff39a73 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMResult.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMResult.mdx @@ -13,7 +13,7 @@ SQCloudResult *SQCloudVMResult (SQCloudVM *vm); Retrieve the raw SQCloudResult associated with the VM. You can then use the SQCloudResult API to further process the SQCloudResult. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx index 8203352..c7f406b 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx @@ -10,11 +10,11 @@ SQCLOUD_RESULT_TYPE SQCloudVMStep (SQCloudVM *vm); ``` ### Description -Evaluate an SQL statement previously compiled by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +Evaluate an SQL statement previously compiled by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). This function resembles the [sqlite3_step](https://www.sqlite.org/c3ref/step.html) SQLite API. ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value diff --git a/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx b/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx index 3463378..38684a2 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMTotalChanges.mdx @@ -19,7 +19,7 @@ If you need to get the total changes from a SQCloudConnection object you can sen ### Parameters -* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sdks/c/sqcloudvmcompile). +* **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). ### Return value An `int64_t` with the number of total changes. From 7f959a124f9f74f03433ab78af4d379f64d53bd3 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Tue, 16 Jul 2024 17:28:28 -0400 Subject: [PATCH 052/185] Completed PHP/Laravel Quickstart guide; corrected Connection String location on other guides --- sqlite-cloud/_nav.ts | 5 +- sqlite-cloud/quick-start-cdn.mdx | 2 +- sqlite-cloud/quick-start-django.mdx | 2 +- sqlite-cloud/quick-start-flask.mdx | 2 +- sqlite-cloud/quick-start-php-laravel.mdx | 147 +++++++++++++++++++++++ 5 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 sqlite-cloud/quick-start-php-laravel.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 1e75071..211ee68 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -12,10 +12,11 @@ const sidebarNav: SidebarNavStruct = [ { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-cdn.mdx b/sqlite-cloud/quick-start-cdn.mdx index da1c43a..0918a73 100644 --- a/sqlite-cloud/quick-start-cdn.mdx +++ b/sqlite-cloud/quick-start-cdn.mdx @@ -157,7 +157,7 @@ Copy the following to your ```index.html``` file: 5. **Query data** - There are 2 ways to query data. - 1. In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and paste it into the form's `Database Connection String` input. The expected string format is: `sqlitecloud://{host}.sqlite.cloud:8860?apikey={apikey}`. + 1. In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and paste it into the form's `Database Connection String` input. The expected string format is: `sqlitecloud://{host}.sqlite.cloud:8860?apikey={apikey}`. - Since this Connection String format does NOT contain the database to query, you MUST include the database name in your query. The expected query format is: `USE DATABASE {database}; select * from {table}`. - IMPORTANT: The example SQL we provide (`USE DATABASE chinook.sqlite; select * from customers limit 3`) queries the `customers` table in the `chinook` database. The results are specifically parsed to be more readable. To display raw data from any table, uncomment the `index.html` code starting after `// list raw data` and comment out the later `for` loop. diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quick-start-django.mdx index 1b627af..0ce9d22 100644 --- a/sqlite-cloud/quick-start-django.mdx +++ b/sqlite-cloud/quick-start-django.mdx @@ -35,7 +35,7 @@ pip install sqlitecloud 4. **App setup** - Create a new file `albums/services.py` and copy in the following code. - - In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and replace `` below. + - In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and replace `` below. ```python import sqlitecloud diff --git a/sqlite-cloud/quick-start-flask.mdx b/sqlite-cloud/quick-start-flask.mdx index 801ed53..b3380f5 100644 --- a/sqlite-cloud/quick-start-flask.mdx +++ b/sqlite-cloud/quick-start-flask.mdx @@ -35,7 +35,7 @@ pip install sqlitecloud 4. **Query data** - Copy the following code into a new `app.py` file. - - In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and replace `` below. + - In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and replace `` below. ```py from flask import Flask diff --git a/sqlite-cloud/quick-start-php-laravel.mdx b/sqlite-cloud/quick-start-php-laravel.mdx new file mode 100644 index 0000000..d5a6ca1 --- /dev/null +++ b/sqlite-cloud/quick-start-php-laravel.mdx @@ -0,0 +1,147 @@ +--- +title: PHP / Laravel Quick Start Guide +description: Get started with SQLite Cloud using PHP and Laravel. +category: getting-started +status: publish +slug: quick-start-php-laravel +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and PHP by building a simple Laravel application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a Laravel app** + - If you haven't already done so, install PHP, Laravel, and Composer. + - If you use macOS, you can install all 3 in 1 click by [downloading Laravel Herd](https://herd.laravel.com/docs/1/getting-started/installation#installation), a PHP dev environment. + - Create a new Laravel project. + +```bash +composer create-project laravel/laravel sqlc-quickstart +``` + + - In the project directory, start Laravel's local dev server. + +```bash +cd sqlc-quickstart +php artisan serve +``` + + - Visit `http://127.0.0.1:8000` to see your Laravel app. + +3. **Configure a Blade frontend** + - Open another terminal. Again in your project dir, install Laravel Breeze. + - By default, Breeze uses simple Blade templates for your app's view layer. Blade is a templating engine included with Laravel. HTML is rendered server-side so you can include dynamic content from your database. + +```bash +composer require laravel/breeze --dev +php artisan breeze:install blade +``` + + - Start a Vite dev server that will hot reload updates to your app. (No need to load the provided localhost link, just keep the Vite server running.) + +```bash +npm run dev +``` + + - Refresh your app in the browser. Click the "Register" link at the top right. Register an account and log in. Save your credentials. + +4. **App setup** + + - Open another terminal. Again in your project dir, run `php artisan make:model -rc Album` to create an Eloquent Model (which we'll ignore) and a HTTP resource controller: `app/Http/Controllers/AlbumController.php`. We'll add functionality to this file to process app requests and return responses later. + - Replace the code in `routes/web.php` with the following snippet to add a route named `albums.index`. + - Run `php artisan route:list` to view all your app routes. + - `albums.index` will route GET requests to the `albums` endpoint to `AlbumController`'s `index` method (will set up later). + +```php +only(['index']); +``` + + - Create a new file `resources/views/albums/index.blade.php` and copy in the following code to create your Blade view template. + +```php +

    Albums

    +
      +@foreach ($albums as $album) +
    • {{ $album['albumTitle'] }} by {{ $album['artistName'] }}
    • +@endforeach +
    +``` + +5. **Install the SQLite Cloud SDK** + +```bash +composer require sqlitecloud/sqlitecloud +``` + +6. **Query data** + + - Replace the code in `app/Http/Controllers/AlbumController.php` with the following snippet. + - In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and replace `` below. + - The `index` method will: + - connect to and query the database, + - create an array of arrays `albums` containing each returned album's title and artist, + - use the global `view` helper to pass `albums` to your view template stored at `resources/views/albums/index.blade.php` (and already set up to list the data), and + - return the completed Blade view to the browser. + +```php +connectWithString(''); + + $db_name = 'chinook.sqlite'; + $db_query = 'SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20'; + + $sqlite->execute("USE DATABASE {$db_name}"); + + $rowset = $sqlite->execute($db_query); + + $sqlite->disconnect(); + + $albums = []; + + for($i = 0; $i < $rowset->nrows; $i++) { + $albums[] = [ + 'albumTitle' => $rowset->value($i, 1), + 'artistName' => $rowset->value($i, 2), + ]; + } + + return view('albums.index', [ + 'albums' => $albums + ]); + } +} +``` + +7. **View your app** + - Visit `http://127.0.0.1:8000/albums` to see your app data. + +8. **FOLLOW-UP:** +This Quickstart goes a bit deeper into the framework than the other Quickstarts since Laravel requires more boilerplate to get up-and-running with a simple app. + +If you're new to Laravel and want to learn more, we referenced the following Laravel Tutorial pages extensively when writing this Quickstart: + - [Installation](https://bootcamp.laravel.com/blade/installation) + - [Controllers, Routing, Blade](https://bootcamp.laravel.com/blade/creating-chirps) + +And that's it! You've successfully built a PHP / Laravel app that reads data from a SQLite Cloud database. \ No newline at end of file From 50a0c5f7ff917153e6005e685d213a7013d862d1 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:13:09 -0400 Subject: [PATCH 053/185] Fixed React Native Quickstart guide: corrected SQL query and simplified code by bringing actions like connecting and querying the database into the main component --- sqlite-cloud/quick-start-react-native.mdx | 117 +++++++++++++--------- 1 file changed, 70 insertions(+), 47 deletions(-) diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 48e275f..2fa3711 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -2,80 +2,103 @@ title: React Native Quick Start Guide description: Get started with SQLite Cloud using React Native. category: getting-started -status: draft +status: publish slug: quick-start-react-native --- + In this quickstart, we will show you how to get started with SQLite Cloud and React Native by building a simple application that connects to and reads from a SQLite Cloud database. --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. - - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. -2. **Create a React Native app** - - Create a React Native app using officially recommended framework Expo with the following command: + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a React Native project** + - If you haven't already, [sign up for an Expo account](https://expo.dev/). + - Create a new remote EAS project with the name `sqlc-quickstart`. + - Link your remote project to a new local project. Replace `{id}` below with the project ID provided by Expo. + ```bash - npx create-expo-app@latest +npm install --global eas-cli +npx create-expo-app sqlc-quickstart +cd sqlc-quickstart +eas init --id {id} ``` - - After creating your project, navigate to the project directory and install the SQLite Cloud SDK: + +3. **Install the SQLite Cloud JS SDK** + ```bash - npm install @sqlitecloud/drivers +npm install @sqlitecloud/drivers ``` -3. **Add data and service layers** - - Create a folder named `db`, then create a file in that folder named `database.js`. This file will be responsible for instantiating the database connection: -```javascript -import { Database } from '@sqlitecloud/drivers'; +4. **Query data** + - Replace the code in `app/(tabs)/index.tsx` with the following snippet. + - In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and replace `` below. -const db = new Database(''); +```jsx +import { Database } from '@sqlitecloud/drivers'; +import { useState, useEffect } from 'react'; +import { View, Text, FlatList, StyleSheet } from 'react-native'; -export default db; -``` - - Next, create a folder named `services` in the root directory of your project. Create a file named `albums.js` within the `services` folder. This file will be responsible for querying data from the database: -```javascript -import db from '../db/database'; - -export const getAlbums = async () => { - const result = await db.exec` - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, albums.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; - return result.fetchall(); -}; -``` -4. **Create a React Native component** - - Navigate to the index.js file in the /app/(tabs) directory and replace the existing code with the following code: -```javascript -import React, { useEffect, useState } from 'react'; -import { Text, View } from 'react-native'; -import { getAlbums } from './services/albums'; - -export default function HomeScreen() { +export default function App() { const [albums, setAlbums] = useState([]); useEffect(() => { - getAlbums().then((data) => setAlbums(data)); + async function getAlbums() { + const db = new Database( + '' + ); + + const result = + await db.sql`USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`; + + setAlbums(result); + } + + getAlbums(); }, []); return ( - - Albums - {albums.map((album) => ( - {album.title} by {album.artist} - ))} + + Albums + item.id} + renderItem={({ item }) => ( + + • {item.title} by {item.artist} + + )} + /> ); } + +const styles = StyleSheet.create({ + container: { + padding: 15, + }, + title: { + fontSize: 34, + fontWeight: 600, + }, + listItem: { + paddingVertical: 3, + }, +}); ``` + - On `App` component mount, `useEffect` defines and calls a function that connects to and queries your database, updates the component's state with the most up-to-date `albums` data, and renders the data in a list. 5. **Run your app** - - Start your React Native app using the following command: + ```bash - npm start +npm start ``` - - Open your Expo Go app on your mobile device and scan the QR code to view your app. + + - To see your app: + - On iOS, use the Camera app to scan the QR code. + - On Android, download and use the Expo Go app to scan the QR code. + - On web, visit the localhost link. And that's it! You've successfully built a React Native app that reads data from a SQLite Cloud database. \ No newline at end of file From 39630d6fe98ffc5f5dfe8ac9297f8298d6498161 Mon Sep 17 00:00:00 2001 From: Caheri Date: Fri, 19 Jul 2024 10:51:46 -0500 Subject: [PATCH 054/185] fixed typo --- sqlite-cloud/quick-start-node.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index ccd4966..87d2731 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -52,7 +52,7 @@ app.listen(3000, () => { ``` 5. **Run your app** ```bash -node app.js +node index.js ``` 6. **View your web server response** - Open your browser and navigate to `http://localhost:3000/albums` to see your app in action. From 6681662b330168f8e7b342f1ca943c61444f9be3 Mon Sep 17 00:00:00 2001 From: Caheri Aguilar <61262911+c-arriagada@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:52:00 -0500 Subject: [PATCH 055/185] Added Streamlit Quick Start guide (#74) * completed streamlit quick start guide * fixed enumeration --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/quick-start-streamlit.mdx | 66 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 sqlite-cloud/quick-start-streamlit.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 211ee68..16c214f 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -16,6 +16,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, diff --git a/sqlite-cloud/quick-start-streamlit.mdx b/sqlite-cloud/quick-start-streamlit.mdx new file mode 100644 index 0000000..3ac6e09 --- /dev/null +++ b/sqlite-cloud/quick-start-streamlit.mdx @@ -0,0 +1,66 @@ +--- +title: Streamlit Quick Start Guide +description: Get started with SQLite Cloud using Streamlit. +category: getting-started +status: publish +slug: quick-start-streamlit +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Streamlit by building a simple application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a Streamlit app** + - You should have the latest Python version (3) installed locally. + +```bash +mkdir sqlc-quickstart +cd sqlc-quickstart + +python3 -m venv .venv +. .venv/bin/activate + +pip install streamlit +``` + +3. **Install the SQLite Cloud SDK** + +```bash +pip install sqlitecloud +``` + +4. **Query data** + - Copy the following code into a new `app.py` file. + - In your SQLite Cloud account dashboard, click your Project name, copy the Connection String, and replace `` below. + +```py +import streamlit as st +import sqlitecloud +import pandas as pd + +st.header('Invoices') + +conn = sqlitecloud.connect('') + +db_name = "chinook.sqlite" +conn.execute(f"USE DATABASE {db_name}") + +invoices = pd.read_sql("SELECT * FROM invoices LIMIT 20", conn) + +st.dataframe(invoices, hide_index=True) +``` + +5. **Run your app** + +```bash +streamlit run app.py +``` + +6. **View your app** + - Open your browser and navigate to the localhost link provided by the previous command to see your app data. + +And that's it! You've successfully built a Streamlit app that reads data from a SQLite Cloud database. \ No newline at end of file From 5e38199fd2784b692832664e88e0b526f5189ad7 Mon Sep 17 00:00:00 2001 From: Caheri Date: Mon, 22 Jul 2024 13:32:24 -0500 Subject: [PATCH 056/185] Completed go/gin quickstart --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/quick-start-gin.mdx | 141 +++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 sqlite-cloud/quick-start-gin.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 16c214f..843c5b3 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -18,6 +18,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/quick-start-gin.mdx b/sqlite-cloud/quick-start-gin.mdx new file mode 100644 index 0000000..dc1f4e4 --- /dev/null +++ b/sqlite-cloud/quick-start-gin.mdx @@ -0,0 +1,141 @@ +--- +title: Gin Quick Start Guide +description: Get started with SQLite Cloud using Gin. +category: getting-started +status: publish +slug: quick-start-gin +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Go by building a simple Gin application that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a Gin app** + - You should have [Go installed](https://go.dev/doc/install) locally. + - Set up your Go workspace. +```bash +mkdir sqlc-quickstart +cd sqlc-quickstart + +go mod init example.com/sqlc-quickstart +``` + - Create a file called `app.go`. + - Add the following code to your `app.go` file. +```go +package main + +import "fmt" +``` + - Import the Gin package in your Go source code. +```go +import "github.com/gin-gonic/gin" +``` + - Run the `go mod tidy` command to synchronize your module's dependencies. +```bash +$ go mod tidy +go: finding module for package github.com/gin-gonic/gin +go: found github.com/gin-gonic/gin in github.com/gin-gonic/gin v1.10.0 +go: downloading github.com/google/go-cmp v0.5.5 +``` + +3. **Install the SQLite Cloud package** +- Import the package in your Go source code. +```go +import sqlitecloud "github.com/sqlitecloud/sqlitecloud-go" +``` +- Download the package, and run the `go mod tidy` command to synchronize your module’s dependencies. +```bash +$ go mod tidy +go: downloading github.com/sqlitecloud/sqlitecloud-go v1.0.0 +``` + +4. **Connect with a valid SQLite Cloud connection string** +```go +sqlitecloud://{username}:{password}@{host}.sqlite.cloud:8860/{database} +``` +- To get your admin username, go to your SQLite Cloud account dashboard. In the left nav, open Security and select Users. Your admin username has already been created. Replace `{username}` in the connection string. +- To set your admin user’s password, click the row’s down chevron and select Edit. Enter a new Password and click Save. Replace `{password}` in the connection string. +- To get the host, see under your Project name `{host}.sqlite.cloud`. +- To get the database name, in the left nav, open Databases and select Tables. All of your databases are listed in the Select Database dropdown. + + +5. **Query data** + - Copy the following code into the `app.go` file. + - Replace ``. + +```go +type Artist struct { + ArtistID int64 `json:"artist id"` + Name string `json:"name"` +} + +func readArtists(resultSet *sqlitecloud.Result) ([]Artist, error) { + var artists []Artist + + for r := uint64(0); r < resultSet.GetNumberOfRows(); r++ { + id, err := resultSet.GetInt64Value(r, 0) + if err != nil { + return nil, err + } + + name, err := resultSet.GetStringValue(r, 1) + if err != nil { + return nil, err + } + + artists = append(artists, Artist{ + ArtistID: id, + Name: name, + }) + } + + return artists, nil +} + +func main() { + r := gin.Default() + + r.GET("/artists", func(c *gin.Context) { + const connectionString = "" + + db, err := sqlitecloud.Connect(connectionString) + if err != nil { + fmt.Println("Connect error: ", err) + panic("Connect error") + } + + dbResult, err := db.Select("SELECT * FROM artists LIMIT 10;") + if err != nil { + fmt.Println("Select error: ", err) + panic("Select error") + } + + artists, err := readArtists(dbResult) + if err != nil { + fmt.Println("Read artists error: ", err) + panic("Read artists error") + } + + c.JSON(200, artists) + + }) + + r.Run() // listen and serve on 0.0.0.0:8080 +} + +``` + +6. **Run your app** + +```bash +$ go run app.go +``` + +7. **View your app** + - Open your browser and navigate to localhost:8080. + +And that's it! You've successfully built a Gin app that reads data from a SQLite Cloud database. \ No newline at end of file From 59c8aadc26eae3084e3c71570fc6b4e5d99081f4 Mon Sep 17 00:00:00 2001 From: Caheri Date: Mon, 22 Jul 2024 13:47:33 -0500 Subject: [PATCH 057/185] updated localhost path to view app --- sqlite-cloud/quick-start-gin.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-gin.mdx b/sqlite-cloud/quick-start-gin.mdx index dc1f4e4..608a0e8 100644 --- a/sqlite-cloud/quick-start-gin.mdx +++ b/sqlite-cloud/quick-start-gin.mdx @@ -136,6 +136,6 @@ $ go run app.go ``` 7. **View your app** - - Open your browser and navigate to localhost:8080. + - Open your browser and navigate to `localhost:8080/artists`. And that's it! You've successfully built a Gin app that reads data from a SQLite Cloud database. \ No newline at end of file From f854c20b862421376de93088cc0b82f7a71a3825 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:54:15 -0400 Subject: [PATCH 058/185] Started Swift Introduction --- sqlite-cloud/_nav.ts | 3 ++ sqlite-cloud/sdks/swift/introduction.mdx | 65 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 sqlite-cloud/sdks/swift/introduction.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 16c214f..5f7f887 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -163,6 +163,9 @@ const sidebarNav: SidebarNavStruct = [ { title: 'Introduction', type: "inner", filePath: "sdk-php-introduction", level: 1 }, { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, + { title: "Swift", type: "inner", level: 0 }, + { title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 }, + { title: "Reference", type: "secondary", icon: "docs-ref" }, { title: "Server-side Commands", type: "inner", level: 0 }, { title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 }, diff --git a/sqlite-cloud/sdks/swift/introduction.mdx b/sqlite-cloud/sdks/swift/introduction.mdx new file mode 100644 index 0000000..830eafc --- /dev/null +++ b/sqlite-cloud/sdks/swift/introduction.mdx @@ -0,0 +1,65 @@ +--- +title: Swift SDK Introduction +description: Get started with SQLite Cloud using Swift. +category: sdks +status: publish +slug: sdk-swift-introduction +--- + +This powerful package provides methods that perform database operations and enable real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. + +## Install + + - In `Package.swift`, add the `swift` package to `dependencies`. The following example snippet is from a project using the Vapor framework. + +```swift +let package = Package( + ... + dependencies: [ + ... + .package(url: "https://github.com/sqlitecloud/swift.git", from: "0.2.1") + ], + targets: [ + .executableTarget( + ... + dependencies: [ + ... + .product(name: "SQLiteCloud", package: "swift") + ], + ... + ), + ] +) +``` + +## Basic Usage + + - + +```swift +import SQLiteCloud + +# explicit +let configuration = SQLiteCloudConfig(hostname: "", username: "", password: "", port: .default) +``` + +```python +import sqlitecloud + +# Open the connection to SQLite Cloud +conn = sqlitecloud.connect("sqlitecloud://myhost.sqlite.cloud:8860?apikey=myapikey") + +# You can autoselect the database during the connect call +# by adding the database name as path of the SQLite Cloud +# connection string, eg: +# conn = sqlitecloud.connect("sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey") +db_name = "chinook.sqlite" +conn.execute(f"USE DATABASE {db_name}") + +cursor = conn.execute("SELECT * FROM albums WHERE AlbumId = ?", (1, )) +result = cursor.fetchone() + +print(result) + +conn.close() +``` From 010965872869d7abc2580edff39a1c068fd4ae17 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 24 Jul 2024 23:59:56 -0400 Subject: [PATCH 059/185] Completed Swift Introduction --- sqlite-cloud/sdks/swift/introduction.mdx | 71 +++++++++++++++++------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/sqlite-cloud/sdks/swift/introduction.mdx b/sqlite-cloud/sdks/swift/introduction.mdx index 830eafc..37221aa 100644 --- a/sqlite-cloud/sdks/swift/introduction.mdx +++ b/sqlite-cloud/sdks/swift/introduction.mdx @@ -6,11 +6,12 @@ status: publish slug: sdk-swift-introduction --- -This powerful package provides methods that perform database operations and enable real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. +This powerful package provides methods that perform DB operations and enables real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK's issues backlog](https://github.com/sqlitecloud/sqlitecloud-swift/issues). ## Install - - In `Package.swift`, add the `swift` package to `dependencies`. The following example snippet is from a project using the Vapor framework. + - In `Package.swift`, add the `swift` package to `dependencies`. + - The following example snippet is from a Swift app using the Vapor framework. ```swift let package = Package( @@ -34,32 +35,64 @@ let package = Package( ## Basic Usage - - + - Currently, there are 2 ways to configure your database connection: + + - 1. Explicitly passing string params: `SQLiteCloudConfig(hostname: {hostname}, username: {username}, password: {password}, port: .default)` + - In your SQLite Cloud account dashboard, click on a Node, copy the Deployment string, and replace `{hostname}` in `configuration` below. + - In your dashboard left nav, select Settings, then Users. Copy your username and replace `{username}`. + - In your User's row, click the down chevron, then Edit. Enter a Password and Save. Replace `{password}`. ```swift import SQLiteCloud -# explicit -let configuration = SQLiteCloudConfig(hostname: "", username: "", password: "", port: .default) +let configuration: SQLiteCloudConfig = SQLiteCloudConfig(hostname: "", username: "", password: "", port: .default) + +let sqliteCloud: SQLiteCloud = SQLiteCloud(config: configuration) + +do { + try await sqliteCloud.connect() + debugPrint("connected") + + let sqlQuery: String = "USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;" + + let result: SQLiteCloudResult = try await sqliteCloud.execute(query: sqlQuery) + + try await sqliteCloud.disconnect() + + return result.stringValue! +} catch { + return "Connection error: \(error)" +} ``` -```python -import sqlitecloud + - 2. Using a connection string: `SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:{port}/{database})` -# Open the connection to SQLite Cloud -conn = sqlitecloud.connect("sqlitecloud://myhost.sqlite.cloud:8860?apikey=myapikey") +```swift +import SQLiteCloud + +let configuration: SQLiteCloudConfig? = SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:8860/chinook.sqlite") + +let sqliteCloud: SQLiteCloud = SQLiteCloud(config: configuration!) + +do { + try await sqliteCloud.connect() + debugPrint("connected") -# You can autoselect the database during the connect call -# by adding the database name as path of the SQLite Cloud -# connection string, eg: -# conn = sqlitecloud.connect("sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey") -db_name = "chinook.sqlite" -conn.execute(f"USE DATABASE {db_name}") + let sqlQuery: String = "USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;" -cursor = conn.execute("SELECT * FROM albums WHERE AlbumId = ?", (1, )) -result = cursor.fetchone() + let result: SQLiteCloudResult = try await sqliteCloud.execute(query: sqlQuery) -print(result) + try await sqliteCloud.disconnect() -conn.close() + return result.stringValue! +} catch { + return "Connection error: \(error)" +} ``` + + - The above snippets include variable types, which may be optional for your app. + +## Troubleshooting + + - If you get errors indicating SQLite Cloud-specific constructs are out of scope (i.e. `error: cannot find 'SQLiteCloudConfig' in scope`), verify the `SQLiteCloud` package is correctly imported. + - Confirm `https://github.com/sqlitecloud/swift` package is listed in `Package.resolved`. \ No newline at end of file From 6a5f1e3686f4a04791c5e7ae66a68e707542279b Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Thu, 25 Jul 2024 21:16:32 -0400 Subject: [PATCH 060/185] Updated to include apikey connection string support in SDK --- sqlite-cloud/sdks/swift/introduction.mdx | 70 ++++++++++-------------- 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/sqlite-cloud/sdks/swift/introduction.mdx b/sqlite-cloud/sdks/swift/introduction.mdx index 37221aa..8222987 100644 --- a/sqlite-cloud/sdks/swift/introduction.mdx +++ b/sqlite-cloud/sdks/swift/introduction.mdx @@ -6,71 +6,59 @@ status: publish slug: sdk-swift-introduction --- -This powerful package provides methods that perform DB operations and enables real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK's issues backlog](https://github.com/sqlitecloud/sqlitecloud-swift/issues). +This powerful package provides methods that perform DB operations, and enables real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK's issues backlog](https://github.com/sqlitecloud/sqlitecloud-swift/issues). ## Install - - In `Package.swift`, add the `swift` package to `dependencies`. - - The following example snippet is from a Swift app using the Vapor framework. + - In `Package.swift`, add the `swift` package to `dependencies`. ```swift let package = Package( - ... + ..., dependencies: [ - ... + ..., .package(url: "https://github.com/sqlitecloud/swift.git", from: "0.2.1") ], - targets: [ - .executableTarget( - ... - dependencies: [ - ... - .product(name: "SQLiteCloud", package: "swift") - ], - ... - ), - ] + ... ) ``` -## Basic Usage +## 3 ways to configure your database connection - - Currently, there are 2 ways to configure your database connection: +1. **RECOMMENDED**: Use the `apikey` connection string. - - 1. Explicitly passing string params: `SQLiteCloudConfig(hostname: {hostname}, username: {username}, password: {password}, port: .default)` - - In your SQLite Cloud account dashboard, click on a Node, copy the Deployment string, and replace `{hostname}` in `configuration` below. - - In your dashboard left nav, select Settings, then Users. Copy your username and replace `{username}`. - - In your User's row, click the down chevron, then Edit. Enter a Password and Save. Replace `{password}`. +In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. ```swift -import SQLiteCloud - -let configuration: SQLiteCloudConfig = SQLiteCloudConfig(hostname: "", username: "", password: "", port: .default) - -let sqliteCloud: SQLiteCloud = SQLiteCloud(config: configuration) - -do { - try await sqliteCloud.connect() - debugPrint("connected") +let configuration = SQLiteCloudConfig(connectionString: "") +``` - let sqlQuery: String = "USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;" +2. Use a parameterized connection string. - let result: SQLiteCloudResult = try await sqliteCloud.execute(query: sqlQuery) + - In your SQLite Cloud account dashboard, click on a Node, copy the Deployment string, and replace `{hostname}` below. + - In your dashboard left nav, select Settings, then Users. Copy your username and replace `{username}`. + - In your User's row, click the down chevron, then Edit. Enter a Password and Save. Replace `{password}`. + - The provided port and database will query the sample dataset that comes pre-loaded with SQLite Cloud. Replace both for your own datasets. - try await sqliteCloud.disconnect() +```swift +let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:8860/chinook.sqlite") +``` + +3. Pass each connection string parameter. - return result.stringValue! -} catch { - return "Connection error: \(error)" -} +```swift +let configuration = SQLiteCloudConfig(hostname: {hostname}, username: {username}, password: {password}, port: .default) ``` - - 2. Using a connection string: `SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:{port}/{database})` +## Connect and query + + - The following snippet includes variable types, which may be optional for your app. + - Once you've incorporated the following, build and run your app! ```swift import SQLiteCloud -let configuration: SQLiteCloudConfig? = SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:8860/chinook.sqlite") +let configuration: SQLiteCloudConfig? = SQLiteCloudConfig(connectionString: "") let sqliteCloud: SQLiteCloud = SQLiteCloud(config: configuration!) @@ -86,12 +74,10 @@ do { return result.stringValue! } catch { - return "Connection error: \(error)" + return "Connection error" } ``` - - The above snippets include variable types, which may be optional for your app. - ## Troubleshooting - If you get errors indicating SQLite Cloud-specific constructs are out of scope (i.e. `error: cannot find 'SQLiteCloudConfig' in scope`), verify the `SQLiteCloud` package is correctly imported. From f26930155603cce1a718501dbc94becfc0b57962 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Fri, 26 Jul 2024 11:03:10 -0700 Subject: [PATCH 061/185] update: graphql apollo example (#79) * feat: add graphql-apollo-example * add nav * update link --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/quick-start-apollo-graphql.mdx | 187 ++++++++++++++++++++ sqlite-cloud/quick-start-cdn.mdx | 2 +- sqlite-cloud/quick-start-django.mdx | 2 +- sqlite-cloud/quick-start-flask.mdx | 2 +- sqlite-cloud/quick-start-next.mdx | 2 +- sqlite-cloud/quick-start-node.mdx | 2 +- sqlite-cloud/quick-start-php-laravel.mdx | 2 +- sqlite-cloud/quick-start-prisma.mdx | 2 +- sqlite-cloud/quick-start-react-native.mdx | 2 +- sqlite-cloud/quick-start-react.mdx | 2 +- sqlite-cloud/quick-start-streamlit.mdx | 2 +- 12 files changed, 198 insertions(+), 10 deletions(-) create mode 100644 sqlite-cloud/quick-start-apollo-graphql.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 5f7f887..e14ac5b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -13,6 +13,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, + { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, diff --git a/sqlite-cloud/quick-start-apollo-graphql.mdx b/sqlite-cloud/quick-start-apollo-graphql.mdx new file mode 100644 index 0000000..6d8611c --- /dev/null +++ b/sqlite-cloud/quick-start-apollo-graphql.mdx @@ -0,0 +1,187 @@ +--- +title: Apollo / GraphQL Quick Start Guide +description: Get started with SQLite Cloud using Apollo and GraphQL. +category: getting-started +status: publish +slug: quick-start-apollo-graphql +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and Apollo/GraphQL by writing a simple GraphQL wrapper around a SQLite Cloud database connection. + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Install the necessary dependencies** + - In your terminal run the following commands to install a new Apollo Server app. + +```bash +mkdir sqlc-quickstart +cd sqlc-quickstart +npm install apollo-server graphql +``` + +3. **Create a new Apollo Server app** + - Create a new file called `server.js` and add the following code. + - Import the necessary packages, and instantiate a new Database connection. +```js +import { ApolloServer } from '@apollo/server'; +import { startStandaloneServer } from '@apollo/server/standalone'; +import { Database } from '@sqlitecloud/drivers'; + +const connStr = '' + +const db = new Database(connStr) +``` +- Next, define your GraphQL schema and resolvers. +```js +const typeDefs = `#graphql + type Album { + AlbumId: Int + Title: String + ArtistId: Int + } + + type Artist { + ArtistId: Int + Name: String + } + + type Track { + TrackId: Int + Name: String + AlbumId: Int + MediaTypeId: Int + GenreId: Int + Composer: String + Milliseconds: Int + Bytes: Int + UnitPrice: Float + } + + type Genre { + GenreId: Int + Name: String + } + + type MediaType { + MediaTypeId: Int + Name: String + } + + type Join { + AlbumId: Int + Title: String + ArtistName: String + } + + type Query { + albums: [Album] + artists: [Artist] + tracks: [Track] + genres: [Genre] + mediaTypes: [MediaType] + joins: [Join] + artist(name: String): Artist + albumsByArtist(artistId: Int): [Album] + } + + type Mutation { + createArtist(name: String): Artist + createAlbum(title: String, artistId: Int): Album + } +`; + +const resolvers = { + Query: { + albums: async () => { + return await db.sql`SELECT * FROM albums`; + }, + artists: async () => { + return await db.sql`SELECT * FROM artists`; + }, + tracks: async () => { + return await db.sql`SELECT * FROM tracks`; + }, + genres: async () => { + return await db.sql`SELECT * FROM genres`; + }, + mediaTypes: async () => { + return await db.sql`SELECT * FROM media_types`; + }, + artist: async (_, { name }) => { + const res = await db.sql`SELECT * FROM artists WHERE Name LIKE ${name};`; + if (res.length === 0) return null; + return res[0]; + }, + albumsByArtist: async (_, { artistId }) => { + return await db.sql`SELECT albums.AlbumId, albums.Title FROM albums INNER JOIN artists ON albums.ArtistId = artists.ArtistId WHERE artists.ArtistId = ${artistId}`; + }, + }, + Mutation: { + createArtist: async (_, { name }) => { + const res = + await db.sql`INSERT INTO artists (Name) VALUES (${name})`; + if (res.changes === 0) return null; + return { ArtistId: res.lastID, Name: name }; + }, + createAlbum: async (_, { title, artistId }) => { + const res = + await db.sql`INSERT INTO albums (Title, ArtistId) VALUES (${title}, ${artistId})`; + if (res.changes === 0) return null; + return { + AlbumId: res.lastID, + Title: title, + ArtistId: artistId, + }; + }, + }, +}; +``` + +- Lastly, pass the GraphQLL type definitions and resolvers into a new ApolloServer instance, and start the server. +```js +const server = new ApolloServer({ typeDefs, resolvers }); + +const { url } = await startStandaloneServer(server, { + listen: { port: 4000 }, + context: async () => ({ db }) +}); + +console.log(`🚀 Server ready at: ${url}`); +``` + +4. **Run your app** + - In your terminal, run the following command to start your Apollo Server. +```bash +node server.js +``` + +5. **Query your data** + - Open your browser and navigate to `http://localhost:4000` to access the Apollo GraphQL Playground. + - Use the following queries to interact with your SQLite Cloud database. + +Read operation: +```graphql +query { + albums { + AlbumId + Title + ArtistId + } +} +``` + +Write operation: +```graphql +mutation { + createArtist(name: "New Artist") { + ArtistId + Name + } +} +``` + +And that's it! You've successfully built an Apollo/GraphQL server that reads and writes data to a SQLite Cloud database. + +For the full code example, see the [SQLite Cloud Apollo/GraphQL example repo](https://github.com/sqlitecloud/examples/tree/main/graphql-apollo/server). diff --git a/sqlite-cloud/quick-start-cdn.mdx b/sqlite-cloud/quick-start-cdn.mdx index 0918a73..57742cc 100644 --- a/sqlite-cloud/quick-start-cdn.mdx +++ b/sqlite-cloud/quick-start-cdn.mdx @@ -11,7 +11,7 @@ In this quickstart, we demonstrate how to locally serve the SQLite Cloud JS Driv --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a JavaScript / TypeScript app** diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quick-start-django.mdx index 0ce9d22..87b1add 100644 --- a/sqlite-cloud/quick-start-django.mdx +++ b/sqlite-cloud/quick-start-django.mdx @@ -9,7 +9,7 @@ slug: quick-start-django In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database. 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Django app** diff --git a/sqlite-cloud/quick-start-flask.mdx b/sqlite-cloud/quick-start-flask.mdx index b3380f5..bbfa5f4 100644 --- a/sqlite-cloud/quick-start-flask.mdx +++ b/sqlite-cloud/quick-start-flask.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Fl --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Flask app** diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 283e5ff..267b036 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Ne --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 87d2731..0c0b8a8 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and No --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Node.js app** - Navigate to your target directory and run the following command to initialize your Node.js app and install the necessary depedencies: diff --git a/sqlite-cloud/quick-start-php-laravel.mdx b/sqlite-cloud/quick-start-php-laravel.mdx index d5a6ca1..03a81c7 100644 --- a/sqlite-cloud/quick-start-php-laravel.mdx +++ b/sqlite-cloud/quick-start-php-laravel.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and PH --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Laravel app** diff --git a/sqlite-cloud/quick-start-prisma.mdx b/sqlite-cloud/quick-start-prisma.mdx index 059ece2..e8fd237 100644 --- a/sqlite-cloud/quick-start-prisma.mdx +++ b/sqlite-cloud/quick-start-prisma.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Pr --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 2fa3711..0667ed6 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React Native project** diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index a64175b..5d46c04 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React app** - Create a React app using a Vite template diff --git a/sqlite-cloud/quick-start-streamlit.mdx b/sqlite-cloud/quick-start-streamlit.mdx index 3ac6e09..ba3b864 100644 --- a/sqlite-cloud/quick-start-streamlit.mdx +++ b/sqlite-cloud/quick-start-streamlit.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and St --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Streamlit app** From 633d3912a03ad3946c73f77537840ce113ee8d2d Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:51:00 +0200 Subject: [PATCH 062/185] missing col counter and wrong result var name --- sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx index 06a7b64..7b3d03c 100644 --- a/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx +++ b/sqlite-cloud/sdks/c/SQCloudRowsetValue.mdx @@ -50,7 +50,7 @@ int main (int argc, const char * argv[]) { // print column names for (uint32_t i=0; i Date: Mon, 29 Jul 2024 10:15:31 +0200 Subject: [PATCH 063/185] Update _nav.ts changed level 3 to level 2 in Rowset APIs --- sqlite-cloud/_nav.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index e14ac5b..a34722e 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -59,14 +59,14 @@ const sidebarNav: SidebarNavStruct = [ { filePath: 'sqlite-cloud/sdks/c/SQCloudResultDump', type: "inner", level: 2 }, { title: "Rowset APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValueType', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetColumnName', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValue', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt32Value', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt64Value', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetFloatValue', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue', type: "inner", level: 3 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDump', type: "inner", level: 3 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValueType', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetColumnName', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValue', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt32Value', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt64Value', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetFloatValue', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue', type: "inner", level: 2 }, + { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDump', type: "inner", level: 2 }, { title: "Array APIs", type: "inner", level: 1 }, From ab767df91a44fcdd01e4f21ebd5df7ba4f093f87 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:38:28 -0400 Subject: [PATCH 064/185] Added clarifications to PHP Intro and synchonized language/ layout with Swift Intro --- sqlite-cloud/quick-start-php-laravel.mdx | 2 +- sqlite-cloud/sdks/php/introduction.mdx | 69 ++++++++++++++++-------- sqlite-cloud/sdks/swift/introduction.mdx | 15 ++++-- 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/sqlite-cloud/quick-start-php-laravel.mdx b/sqlite-cloud/quick-start-php-laravel.mdx index 03a81c7..bebaa60 100644 --- a/sqlite-cloud/quick-start-php-laravel.mdx +++ b/sqlite-cloud/quick-start-php-laravel.mdx @@ -86,7 +86,7 @@ composer require sqlitecloud/sqlitecloud 6. **Query data** - Replace the code in `app/Http/Controllers/AlbumController.php` with the following snippet. - - In your SQLite Cloud account dashboard, click on a Node, copy the Connection String, and replace `` below. + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. - The `index` method will: - connect to and query the database, - create an array of arrays `albums` containing each returned album's title and artist, diff --git a/sqlite-cloud/sdks/php/introduction.mdx b/sqlite-cloud/sdks/php/introduction.mdx index 516a053..e2591cf 100644 --- a/sqlite-cloud/sdks/php/introduction.mdx +++ b/sqlite-cloud/sdks/php/introduction.mdx @@ -6,22 +6,35 @@ status: publish slug: sdk-php-introduction --- - -[![Test and QA][test-qa-img]][test-qa-url] -[![codecov][codecov-img]][codecov-url] -[![Packagist Version][packagist-version-img]][packagist-url] -[![PHP][php-img]][packagist-url] +This powerful package provides methods that simplify performing database operations in PHP applications, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK’s issues backlog](https://github.com/sqlitecloud/sqlitecloud-php/issues). ## Install + - Run the following command to initialize a PHP project and install the SDK. + ```bash $ composer require sqlitecloud/sqlitecloud ``` -SQLite Cloud is a powerful PHP package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. -This package is designed to simplify database operations in PHP applications, making it easier than ever to work with SQLite Cloud. +## Configure your database connection + + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. + +```php +$sqlite->connectWithString(""); +``` + + - You can modify the connection string to include the name of the database to query. + - Here, the provided port (`8860`) and database (`chinook.sqlite`) will query the sample dataset that comes pre-loaded with SQLite Cloud. Replace to query your own datasets. + +```php +$sqlite->connectWithString('sqlitecloud://{hostname}:8860/chinook.sqlite?apikey={apikey}'); +``` + +## Connect and query -## Example + - Include the following snippet in a new `example.php` file. + - NOTE: `$sqlite->execute("USE DATABASE {$db_name}");` is only necessary if your connection string does NOT specify the name of the database to query. ```php connectWithString('sqlitecloud://myhost.sqlite.cloud:8860?apikey=myapikey'); +$sqlite->connectWithString(""); -// You can autoselect the database during the connect call -// by adding the database name as path of the SQLite Cloud -// connection string, eg: -// $sqlite->connectWithString("sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey"); $db_name = 'chinook.sqlite'; $sqlite->execute("USE DATABASE {$db_name}"); - /** @var SQLiteCloudRowset */ +/** @var SQLiteCloudRowset */ $rowset = $sqlite->execute('SELECT * FROM albums WHERE ArtistId = 2'); printf('%d rows' . PHP_EOL, $rowset->nrows); @@ -54,18 +62,35 @@ for ($i = 0; $i < $rowset->nrows; $i++) { $sqlite->disconnect(); ``` -## PHP Admin -To better understand the PHP APIs usage we developed a simple PHP Admin interface that can be used to administer any SQLite Cloud node. + - Run your app! + +``` +php example.php +``` + +## PHP Admin Dashboard + +You can use SQLite Cloud's simplified PHP Admin interface to administer any node. + + - Clone the PHP SDK, install lock file dependencies, and run the dashboard locally. + +```bash +git clone https://github.com/sqlitecloud/sqlitecloud-php.git + +composer update # or composer install +cd admin +php -S localhost:8000 +``` + + - Login as your admin user. + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Deployment string, and paste in `Hostname`. + - In your dashboard left nav, select Settings, then Users. Copy your admin user's username and paste in `Username`. + - In your User's row, click the down chevron, then Edit. Enter a Password and Save. Paste in `Password`. -You can login using admin credentials: ![PHP Admin Login](@docs-website-assets/php/admin_login.png) -And then administer your node with a convenient user interface: ![PHP Admin Overview](@docs-website-assets/php/admin_overview.png) -PHP Admin source code is available in a [GitHub repo](https://github.com/sqlitecloud/sqlitecloud-php/tree/main/admin). - -## More [test-qa-img]: https://github.com/sqlitecloud/sqlitecloud-php/actions/workflows/deploy.yaml/badge.svg?branch=main [test-qa-url]: https://github.com/sqlitecloud/sqlitecloud-php/actions/workflows/deploy.yaml [codecov-img]: https://codecov.io/gh/sqlitecloud/sqlitecloud-php/graph/badge.svg?token=3FFHULGCOY diff --git a/sqlite-cloud/sdks/swift/introduction.mdx b/sqlite-cloud/sdks/swift/introduction.mdx index 8222987..58c3679 100644 --- a/sqlite-cloud/sdks/swift/introduction.mdx +++ b/sqlite-cloud/sdks/swift/introduction.mdx @@ -27,24 +27,30 @@ let package = Package( 1. **RECOMMENDED**: Use the `apikey` connection string. -In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. ```swift let configuration = SQLiteCloudConfig(connectionString: "") ``` + - You can modify the connection string to include the name of the database to query. + +```swift +let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://{hostname}:8860/{database}?apikey={apikey}") +``` + 2. Use a parameterized connection string. - - In your SQLite Cloud account dashboard, click on a Node, copy the Deployment string, and replace `{hostname}` below. + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Deployment string, and replace `{hostname}` below. - In your dashboard left nav, select Settings, then Users. Copy your username and replace `{username}`. - In your User's row, click the down chevron, then Edit. Enter a Password and Save. Replace `{password}`. - - The provided port and database will query the sample dataset that comes pre-loaded with SQLite Cloud. Replace both for your own datasets. + - Here, the provided port (`8860`) and database (`chinook.sqlite`) will query the sample dataset that comes pre-loaded with SQLite Cloud. Replace to query your own datasets. ```swift let configuration = SQLiteCloudConfig(connectionString: "sqlitecloud://{username}:{password}@{hostname}:8860/chinook.sqlite") ``` -3. Pass each connection string parameter. +3. Pass each connection string parameter explicitly. ```swift let configuration = SQLiteCloudConfig(hostname: {hostname}, username: {username}, password: {password}, port: .default) @@ -53,6 +59,7 @@ let configuration = SQLiteCloudConfig(hostname: {hostname}, username: {username} ## Connect and query - The following snippet includes variable types, which may be optional for your app. + - NOTE: `USE DATABASE chinook.sqlite;` is only necessary in the query if your `configuration` does not specify the name of the database to query. - Once you've incorporated the following, build and run your app! ```swift From 8c617e3caeae533aeab7542590e9e1fcfffb1baf Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 5 Aug 2024 14:22:19 -0700 Subject: [PATCH 065/185] add vector search (#81) * update * update * update title --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/platform/extensions.mdx | 9 ++- sqlite-cloud/platform/vector.mdx | 109 +++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 sqlite-cloud/platform/vector.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 77fd95a..5086578 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -25,6 +25,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + { title: "Vector", filePath: "vector", type: "inner", level: 0 }, { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, { title: "Security and Access Control", filePath: "security", type: "inner", level: 0 }, { title: "Backups", filePath: "backups", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/extensions.mdx b/sqlite-cloud/platform/extensions.mdx index b12bb81..677fc20 100644 --- a/sqlite-cloud/platform/extensions.mdx +++ b/sqlite-cloud/platform/extensions.mdx @@ -10,9 +10,10 @@ SQLite Cloud comes with the following pre-installed SQLite extensions. These ext ## Extensions - **[Full-text Search 5](https://www.sqlite.org/fts5.html)**: Full-text search engine that allows you to search for text in a database. -- **[JSON1](https://www.sqlite.org/json1.html)**: Extension that allows you to store, query, and manipulate JSON data. -- **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Extension that provides mathematical functions. -- **[RTree](https://www.sqlite.org/rtree.html)**: Extension that provides an R-Tree index for storing and querying spatial data. -- **[Geopoly](https://www.sqlite.org/geopoly.html)**: Extension that provides functions for working with geospatial data. +- **[JSON1](https://www.sqlite.org/json1.html)**: Allows you to easily store, query, and manipulate JSON data. +- **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Mathematical functions. +- **[RTree](https://www.sqlite.org/rtree.html)**: R-Tree index for storing and querying spatial data. +- **[Geopoly](https://www.sqlite.org/geopoly.html)**: Functions for working with geospatial data. +- **[sqlite-vec](/docs/vector-search)**: Vector storage extension for similarity search. In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by [adding to this issue](https://github.com/sqlitecloud/docs/issues/34). \ No newline at end of file diff --git a/sqlite-cloud/platform/vector.mdx b/sqlite-cloud/platform/vector.mdx new file mode 100644 index 0000000..66ae394 --- /dev/null +++ b/sqlite-cloud/platform/vector.mdx @@ -0,0 +1,109 @@ +--- +title: SQLite Cloud Vector Search +description: Vector storage extension for similarity search in SQLite Cloud. +category: platform +status: publish +slug: vector +--- +Every SQLite Cloud database comes with the `sqlite-vec` extension pre-installed. This allows you to store and query vectors in your database, which enables similarity search functionality. + +## Overview +`sqlite-vec` is a no-dependency SQLite extension for vector search, written entirely in a single C file. It's extremely portable, works in most operating systems and environments, and is MIT/Apache-2 dual licensed. + +Using sqlite-vec is similar to using full-text search in SQLite. Declare a "virtual table" with vector columns, insert data with normal INSERT INTO statements, and query with normal SELECT statements. + +`sqlite-vec` is currently built and optimized for brute-force vector search. This means there is no approximate nearest neighbor search available, limiting the number of vectors that can be searched in a reasonable amount of time. + +## Usage +### Create a vector table + +To create a virtual vector table, use vec0 and the following syntax: + +```sql +create virtual table vec_table_name using vec0( + id integer primary key autoincrement, + embedding float[384] +-- other columns like: +-- text text, +-- metadata blob, +); +``` + +### Insert vectors +Insert vectors as you would with any other data: + +```sql +insert into vec_table_name(embedding) values + ('[0.1, 0.2, ...]'), + ('[0.3, 0.4, ...]'), + ('[0.5, 0.6, ...]'); +``` +### Execute a similarity search query +To search for similar vectors, use the following syntax: + +```sql +select + rowid, + distance +from vec_table_name +where embedding match + and k = 20; +``` + +The value of k sets the number of nearest neighbors to return. For more on nearest neighbor searches, check out our article on the topic. + +## Quantization +Vector quantization is a category of techniques to compress the individual elements inside of a floating point vector. In a float vector, each element is stored as a 32-bit floating point number. For longer vectors, this will quickly require a large amount of storage. + +To reduce storage requirements with minimal loss of accuracy, we recommend using bit vectors as a method of quantization. With bit vector, each dimension in the vector takes up 1 bit. This method delivers up to a 32x reduction in storage requirements. + +When using bit vectors, we recommend using embedding models that are trained on binary quantization loss. This will help maintain accuracy even after converting to binary. + +To convert a float vector to a binary vector, use the vec_quantize_binary() function: + +```sql +create virtual table vec_table using vec0( + embedding float[1536] +); + +-- slim because "embedding_coarse" is quantized 32x to a bit vector +create virtual table vec_table_slim using vec0( + embedding_coarse bit[1536] +); + +insert into vec_table_slim + select rowid, vec_quantize_binary(embedding) from vec_table; +``` +## Matryoshka embeddings +sqlite-vec also supports Matryoshka embeddings, a technique in some embeddings models that allows you to "truncate" excess dimensions of a given vector, without a significant loss in quality. + +Matryoshka embedding save on storage and result in faster queries. + +To create a Matryoshka embedding, use the vec_slice() function: + +```sql + +create virtual table vec_items using vec0( + embedding float[1536] +); + +-- slim because "embedding" is a truncated version of the full vector +create virtual table vec_items_slim using vec0( + embedding_coarse float[512] +); + +insert into vec_items_slim + select + rowid, + vec_normalize(vec_slice(embedding, 0, 512)) + from vec_items; +``` + +## Performance considerations +Free SQLite Cloud plans are not optimized for vector workloads. To speak to the team about upgrading your plan, [please reach out](https://www.sqlitecloud.io/support). + +## Next Steps +Combined with [edge functions](/docs/edge-functions), SQLite Cloud's vector search capabilities make it a great choice for serverless RAG applications. + + + From 953e648b3e836238f61b74f6c21a1253aed93de8 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 5 Aug 2024 14:25:45 -0700 Subject: [PATCH 066/185] fix link --- sqlite-cloud/platform/extensions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/extensions.mdx b/sqlite-cloud/platform/extensions.mdx index 677fc20..3b9931d 100644 --- a/sqlite-cloud/platform/extensions.mdx +++ b/sqlite-cloud/platform/extensions.mdx @@ -14,6 +14,6 @@ SQLite Cloud comes with the following pre-installed SQLite extensions. These ext - **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Mathematical functions. - **[RTree](https://www.sqlite.org/rtree.html)**: R-Tree index for storing and querying spatial data. - **[Geopoly](https://www.sqlite.org/geopoly.html)**: Functions for working with geospatial data. -- **[sqlite-vec](/docs/vector-search)**: Vector storage extension for similarity search. +- **[sqlite-vec](/docs/vector)**: Vector storage extension for similarity search. In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by [adding to this issue](https://github.com/sqlitecloud/docs/issues/34). \ No newline at end of file From 34c2736b49bbea55d48c71c20439285e7a704f61 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 5 Aug 2024 14:26:05 -0700 Subject: [PATCH 067/185] fix link (#82) --- sqlite-cloud/platform/extensions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/extensions.mdx b/sqlite-cloud/platform/extensions.mdx index 677fc20..3b9931d 100644 --- a/sqlite-cloud/platform/extensions.mdx +++ b/sqlite-cloud/platform/extensions.mdx @@ -14,6 +14,6 @@ SQLite Cloud comes with the following pre-installed SQLite extensions. These ext - **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Mathematical functions. - **[RTree](https://www.sqlite.org/rtree.html)**: R-Tree index for storing and querying spatial data. - **[Geopoly](https://www.sqlite.org/geopoly.html)**: Functions for working with geospatial data. -- **[sqlite-vec](/docs/vector-search)**: Vector storage extension for similarity search. +- **[sqlite-vec](/docs/vector)**: Vector storage extension for similarity search. In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by [adding to this issue](https://github.com/sqlitecloud/docs/issues/34). \ No newline at end of file From 5752e10f4d716935f935708cdd686420a2e04957 Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Tue, 6 Aug 2024 20:06:37 +0200 Subject: [PATCH 068/185] typo --- sqlite-cloud/quick-start-apollo-graphql.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/quick-start-apollo-graphql.mdx b/sqlite-cloud/quick-start-apollo-graphql.mdx index 6d8611c..1fe4126 100644 --- a/sqlite-cloud/quick-start-apollo-graphql.mdx +++ b/sqlite-cloud/quick-start-apollo-graphql.mdx @@ -139,7 +139,7 @@ const resolvers = { }; ``` -- Lastly, pass the GraphQLL type definitions and resolvers into a new ApolloServer instance, and start the server. +- Lastly, pass the GraphQL type definitions and resolvers into a new ApolloServer instance, and start the server. ```js const server = new ApolloServer({ typeDefs, resolvers }); From 252c9c19f97fa2bf2486226994db923d5058c900 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 7 Aug 2024 01:37:19 -0400 Subject: [PATCH 069/185] Started Geopoly example app tutorial --- sqlite-cloud/_nav.ts | 4 + sqlite-cloud/tutorial-geopoly.mdx | 801 ++++++++++++++++++++++++++++++ 2 files changed, 805 insertions(+) create mode 100644 sqlite-cloud/tutorial-geopoly.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 5086578..16f2307 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -20,6 +20,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Tutorials", type: "inner", level: 0 }, + { title: "SQLite Spotlight: Geopoly Extension", filePath: "tutorial-geopoly", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, @@ -140,6 +142,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, + { title: "Tutorials", type: "inner", level: 1 }, + { title: "SQLite Spotlight: Geopoly Extension", ref: "/docs/tutorial-geopoly", type: "inner", level: 2 }, { title: "Classes", type: "inner", level: 1 }, { title: "Database", filePath: 'sqlite-cloud/sdks/js/classes/Database', type: "inner", level: 2 }, { title: "SQLiteCloudConnection", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, diff --git a/sqlite-cloud/tutorial-geopoly.mdx b/sqlite-cloud/tutorial-geopoly.mdx new file mode 100644 index 0000000..b537342 --- /dev/null +++ b/sqlite-cloud/tutorial-geopoly.mdx @@ -0,0 +1,801 @@ +--- +title: SQLite Spotlight - Geopoly Extension +description: Build a local attractions finder app using SQLite Cloud, SQLite's built-in Geopoly extension, Mapbox, and React. +category: getting-started +status: publish +slug: tutorial-geopoly +--- + +This tutorial demonstrates how to build a local attractions finder app. The app uses: +- GeoJSON data +- a SQLite Cloud database +- Mapbox JavaScript Graphics Library (GL JS) + - user has to create an account/ get a token! +- React +- SQLite's built-in Geopoly extension + +Time to complete: ~15-20 mins. + +If you get stuck in the tutorial or prefer to play with the finished product, check out [the example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly). + +--- + +1. **Initialize your app** + - Create a new directory `sqlc-geopoly-demo`. From this directory, bootstrap a Node.js project. + +```bash +mkdir sqlc-geopoly-demo +cd sqlc-geopoly-demo +npm init -y +``` + +2. **Curate your GeoJSON data** + + - We will leverage the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) (an open-source, read-only API for fetching OpenStreetMap data) to query NYC attractions. + + - Visit [Overpass Turbo](https://overpass-turbo.eu/), the Overpass GUI. Copy and paste in the below query which: + - defines New York as the area of interest; + - fetches nodes in the specified area that are tagged with the keys `amenity`, `historic`, `tourism`, `leisure`, etc.; and + - outputs the data. + +```c +[out:json][timeout:25]; + +area[name="New York"]->.newyork; + +( + node["amenity"="events_venue"](area.newyork); + node["amenity"="exhibition_centre"](area.newyork); + node["amenity"="music_venue"](area.newyork); + node["amenity"="social_centre"](area.newyork); + node["amenity"="marketplace"](area.newyork); + node["building"="museum"](area.newyork); + node["historic"="building"](area.newyork); + node["tourism"="attraction"](area.newyork); + node["leisure"="park"](area.newyork); + node["natural"="beach"](area.newyork); + node["shop"="coffee"](area.newyork); + node["sport"="yoga"](area.newyork); +); + +out body; +>; +out skel qt; +``` + + - Run the query. + + - Click Export. Under Data, copy the GeoJSON. + + - Use [a JSON formatter](https://jsonformatter.org/) to correctly format the copied JSON. + + - Back in your project dir, create `data/geodata.json`. Paste the formatted GeoJSON into the file. It should look as follows: + +```json +{ + "type": "FeatureCollection", + "generator": "overpass-turbo", + "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.", + "timestamp": "2024-08-05T23:56:57Z", + "features": [ + { + "type": "Feature", + "properties": { + "@id": "node/43058007", + "ele": "190", + "gnis:feature_id": "968527", + "leisure": "park", + "name": "Kibler Park" + }, + "geometry": { + "type": "Point", + "coordinates": [-78.6723302, 43.1655945] + }, + "id": "node/43058007" + }, + ..., + { + "type": "Feature", + "properties": { + "@id": "node/12093603396", + "amenity": "events_venue", + "name": "Azteca Venue Party Center" + }, + "geometry": { + "type": "Point", + "coordinates": [-74.1244477, 40.6338683] + }, + "id": "node/12093603396" + } + ] +} +``` + + - To pull other types of attractions or any other kind of location data in an area of interest to you, refer to [OpenStreetMap's Map features documentation](https://wiki.openstreetmap.org/wiki/Map_features) and modify the above query's area and key-value pairs. + + - NOTE: The app currently only works with Point features (represented in the [doc's](https://wiki.openstreetmap.org/wiki/Map_features) Element column by an icon containing a dot), so be sure to query only: + - nodes, and + - the key-value pairs that can return Point data. For example, don't use most values available for the Boundary key. + + - To implement more complex or granular Point queries, refer to the [Overpass QL documentation](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL). + +3. **Create a new / empty SQLite Cloud database** + + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + + - In your account dashboard's left nav, click Databases, then the Create Database button. To minimize code changes, name your new database `geopoly-demo`. + +4. **Set an environment variable** + + - In your project dir, create a `.env` file with a new environment variable `REACT_APP_CONNECTION_STRING`. Copy your connection string from your account dashboard and assign it to the variable. + - CONTEXT: This app will use `react-scripts`, which leverages Create React App under-the-hood. Create React App offers built-in support for env vars. You will not need to manually configure `webpack` or another bundler, but all vars must be prefixed with `REACT_APP_`. + + - Install the SQLite Cloud JS SDK and dotenv package as dependencies: + +```bash +npm i @sqlitecloud/drivers +npm i -D dotenv +``` + +5. **Create your DB tables** + + - In your project dir, create `src/helpers/createDatabase.js`. Copy and paste in the following code: + +```js +import { Database } from '@sqlitecloud/drivers'; +import 'dotenv/config'; +import geodata from '../../data/geodata.json' assert { type: 'json' }; + +async function createDatabase() { + const db = new Database(process.env.REACT_APP_CONNECTION_STRING); + + const db_name = 'geopoly-demo'; + await db.sql`USE DATABASE ${db_name};`; + + await db.sql`CREATE VIRTUAL TABLE polygons USING geopoly()`; + + await db.sql`CREATE TABLE attractions (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, lng REAL NOT NULL, lat REAL NOT NULL, coordinates TEXT NOT NULL)`; + + for (const feature of geodata['features']) { + const { name } = feature.properties; + const { coordinates } = feature.geometry; + const [lng, lat] = coordinates; + + await db.sql`INSERT INTO attractions(name, lng, lat, coordinates) VALUES(${name}, ${lng}, ${lat}, ${JSON.stringify( + coordinates + )})`; + } + + db.close(); + + console.log('Geodata inserted!'); +} + +createDatabase(); +``` + + - The `createDatabase` function: + - connects to your `geopoly-demo` database + - creates a virtual Geopoly table with 2 columns: `rowid` (which does not display in SQLite Cloud's Console but can be queried) and `_shape` + - creates an `attractions` table with 5 columns: `id`, `name`, `lng`, `lat`, and `coordinates` + - populates the `attractions` table using the GeoJSON FeatureCollection you generated earlier + - closes the database connection. + + - Add the following script to your `package.json`: + +```json +"scripts": { + "create-tables": "node src/helpers/createDatabase.js" +} +``` + + - Run `npm run create-tables`. + + - The time it will take for the command to finish creating tables and inserting the geodata will depend on the size of your FeatureCollection. The example Overpass query provided above returns ~2000 NYC Point features and takes a couple of minutes. + + - As an aside: To see the inserted attractions geodata, in your SQLite Cloud account dashboard's left nav, click Console. Copy, paste in, and run the following query: + +```sql +SELECT * FROM attractions ORDER BY id DESC; +``` + - If you used the provided Overpass query, ~2000 rows are added. + +6. **Setup the frontend** + + - In your project dir, create `public/index.html`. Copy and paste in the following code: + +```html + + + + + + + Local Attraction Finder + + + +
    + + +``` + + - In the `src` dir, add 3 files: `index.css` (for app styling), `index.js` (the app entrypoint file), and `App.js` (the one-and-only component). Copy and paste in the following code for each file: + +`index.css` +```css +@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@100..900&display=swap'); + +* { + box-sizing: border-box; +} + +body { + margin: 0; + padding: 0; + font: 400 15px/22px 'Inter Tight', sans-serif; + -webkit-font-smoothing: antialiased; +} + +.legend { + padding: 10px; + background-color: #23374b; + color: #fff; + font-family: monospace; +} + +.sidebar { + position: absolute; + width: 25%; + height: 100%; + overflow: hidden; +} + +.map-container { + position: absolute; + left: 25%; + width: 75%; + top: 0; + bottom: 0; +} + +.heading { + padding: 0 10px; + border-bottom: 1px solid #eee; +} + +.listings { + height: 72%; + overflow: auto; + padding-bottom: 15px; +} + +.listings .item { + padding: 10px; + border-bottom: 1px solid #eee; +} + +.listings .item.active { + background-color: #cfe1f8; +} + +.listings .item:last-child { + border-bottom: none; +} + +.listings .item .title { + color: #5a5877; + font-weight: 700; + text-decoration: none; +} + +.listings .item.active .title, +.listings .item .title:hover { + color: #000; +} + +::-webkit-scrollbar { + width: 5px; +} + +::-webkit-scrollbar-track { + background: none; +} + +::-webkit-scrollbar-thumb { + background: #23374b; +} + +.mapboxgl-popup { + padding-bottom: 20px; +} + +.mapboxgl-popup-close-button { + display: none; +} + +.mapboxgl-popup-content { + padding: 0; +} + +.mapboxgl-popup-content h3 { + background: #cfe1f8; + color: #000; + margin: 0; + padding: 10px; + border-radius: 3px 3px 0 0; + font-weight: 700; + margin-top: -15px; +} + +.mapboxgl-popup-content h4 { + margin: 0; + padding: 10px; + font-weight: 400; +} + +.marker { + border: none; + cursor: pointer; + width: 26px; + height: 34px; + background-image: url('https://docs.mapbox.com/mapbox-gl-js/assets/custom_marker.png'); +} + +.mapboxgl-ctrl-geocoder { + border: 0; + border-radius: 0; + position: relative; + top: 0; + width: 800px; + margin-top: 0; +} + +.mapboxgl-ctrl-geocoder > div { + min-width: 100%; + margin-left: 0; +} +``` + + - NOTE: To simplify this tutorial, `.marker.background-image` uses a custom Mapbox marker for the map pins marking attractions. [The example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly) uses a custom marker image included in the repo's `images` dir (excluded here). + +`index.js` +```js +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import 'mapbox-gl/dist/mapbox-gl.css'; +import './index.css'; +import App from './App.js'; + +const container = document.querySelector('#root'); +const root = createRoot(container); +root.render( + + + +); +``` + +`App.js` +```js +import { useState, useEffect, useRef } from 'react'; +import mapboxgl from 'mapbox-gl'; +import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css'; +import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder'; +import { point, distance } from '@turf/turf'; +import { Database } from '@sqlitecloud/drivers'; +import { getBbox } from './helpers/getBbox.js'; + +mapboxgl.accessToken = + 'pk.eyJ1IjoidW5hdGFyYWphbiIsImEiOiJjbDFpcW82MGYxeDE1M2RwNjU4MmZ1YndsIn0.HyxwEtZz-pQ_7R6e48l0-g'; + +function App() { + const mapContainerRef = useRef(); + const mapRef = useRef(); + + const [lng, setLng] = useState(-73.9654897); + const [lat, setLat] = useState(40.7824635); + const [zoom, setZoom] = useState(12); + + const [places, setPlaces] = useState([]); + const [geometry, setGeometry] = useState([]); + + const units = 'miles'; + + async function queryGeopoly(searchedLng, searchedLat) { + const db = new Database(process.env.REACT_APP_CONNECTION_STRING); + + const db_name = 'geopoly-demo'; + + const radius = 0.05; + const sides = 50; + + const polygonCoords = + await db.sql`USE DATABASE ${db_name}; INSERT INTO polygons(_shape) VALUES(geopoly_regular(${searchedLng}, ${searchedLat}, ${radius}, ${sides})) RETURNING geopoly_json(_shape);`; + + const attractionsInPolygon = + await db.sql`USE DATABASE ${db_name}; SELECT name, coordinates FROM attractions WHERE geopoly_contains_point(${polygonCoords[0]['geopoly_json(_shape)']}, lng, lat);`; + + db.close(); + + const namedAttractions = attractionsInPolygon.filter( + (attraction) => attraction.name !== null + ); + + const attractionFeatures = namedAttractions.map((attraction, index) => { + const attractionCoordinates = JSON.parse(attraction['coordinates']); + + const attractionFeature = { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: attractionCoordinates, + }, + properties: { + id: index, + title: attraction['name'], + distance: distance( + point([searchedLng, searchedLat]), + point(attractionCoordinates), + { + units, + } + ), + }, + }; + + const marker = document.createElement('div'); + marker.key = `marker-${attractionFeature.properties.id}`; + marker.id = `marker-${attractionFeature.properties.id}`; + marker.className = 'marker'; + + marker.addEventListener('click', (e) => { + handleClick(attractionFeature); + }); + + new mapboxgl.Marker(marker) + .setLngLat(attractionCoordinates) + .addTo(mapRef.current); + + return attractionFeature; + }); + + attractionFeatures.sort((a, b) => { + if (a.properties.distance > b.properties.distance) { + return 1; + } + if (a.properties.distance < b.properties.distance) { + return -1; + } + return 0; + }); + + setPlaces(attractionFeatures); + + if (attractionFeatures[0]) { + const bbox = getBbox(attractionFeatures, searchedLng, searchedLat); + mapRef.current.fitBounds(bbox, { + padding: 100, + }); + + new mapboxgl.Popup({ closeOnClick: false }) + .setLngLat(attractionFeatures[0].geometry.coordinates) + .setHTML( + `

    ${ + attractionFeatures[0].properties.title + }

    ${attractionFeatures[0].properties.distance.toFixed( + 2 + )} ${units} away

    ` + ) + .addTo(mapRef.current); + } + + setGeometry([ + { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [JSON.parse(polygonCoords[0]['geopoly_json(_shape)'])], + }, + }, + ...attractionFeatures, + ]); + } + + function drawFeatureCollection() { + const sourceId = 'newyork'; + + if (!mapRef.current.getSource(sourceId)) { + mapRef.current.addSource(sourceId, { + type: 'geojson', + data: { + type: 'FeatureCollection', + features: geometry, + }, + }); + + mapRef.current.addLayer({ + id: 'polygon', + type: 'fill', + source: sourceId, + paint: { + 'fill-color': '#888888', + 'fill-opacity': 0.4, + }, + filter: ['==', '$type', 'Polygon'], + }); + + mapRef.current.addLayer({ + id: 'outline', + type: 'line', + source: sourceId, + layout: {}, + paint: { + 'line-color': '#000', + 'line-width': 1, + }, + }); + } else { + mapRef.current.getSource(sourceId).setData({ + type: 'FeatureCollection', + features: geometry, + }); + } + } + + function handleClick(feature) { + const center = feature.geometry.coordinates; + const { id, title, distance } = feature.properties; + + mapRef.current.flyTo({ + center, + zoom: 15, + }); + + const popUps = document.getElementsByClassName('mapboxgl-popup'); + if (popUps[0]) { + popUps[0].remove(); + } + + new mapboxgl.Popup({ closeOnClick: false }) + .setLngLat(center) + .setHTML(`

    ${title}

    ${distance.toFixed(2)} ${units} away

    `) + .addTo(mapRef.current); + + const activeItem = document.getElementsByClassName('active'); + if (activeItem[0]) { + activeItem[0].classList.remove('active'); + } + + const listing = document.getElementById(`listing-${id}`); + listing.classList.add('active'); + } + + useEffect(() => { + mapRef.current = new mapboxgl.Map({ + container: mapContainerRef.current, + style: 'mapbox://styles/mapbox/streets-v12', + center: [lng, lat], + zoom, + }); + + const geocoder = new MapboxGeocoder({ + accessToken: mapboxgl.accessToken, + mapboxgl, + zoom: 12, + }); + + const fullscreenCtrl = new mapboxgl.FullscreenControl({ + container: mapContainerRef.current, + }); + + const geolocateCtrl = new mapboxgl.GeolocateControl({ + fitBoundsOptions: { + maxZoom: 12, + }, + positionOptions: { + enableHighAccuracy: true, + }, + trackUserLocation: true, + }); + + mapRef.current.addControl(geocoder); + mapRef.current.addControl(fullscreenCtrl); + mapRef.current.addControl(geolocateCtrl); + + function updateCoordinates() { + const { lng, lat } = mapRef.current.getCenter(); + setLng(lng.toFixed(4)); + setLat(lat.toFixed(4)); + setZoom(mapRef.current.getZoom().toFixed(2)); + } + + mapRef.current.on('move', updateCoordinates); + + geocoder.on('result', (e) => { + const existingMarkers = document.getElementsByClassName('marker'); + while (existingMarkers[0]) { + existingMarkers[0].remove(); + } + + const popUps = document.getElementsByClassName('mapboxgl-popup'); + while (popUps[0]) { + popUps[0].remove(); + } + + const [lng, lat] = e.result.geometry.coordinates; + queryGeopoly(lng, lat); + }); + + return () => { + mapRef.current.removeControl(geocoder); + mapRef.current.removeControl(fullscreenCtrl); + mapRef.current.removeControl(geolocateCtrl); + mapRef.current.off('move', updateCoordinates); + mapRef.current.remove(); + }; + }, []); // eslint-disable-line react-hooks/exhaustive-deps + + useEffect(() => { + if (geometry.length !== 0) { + drawFeatureCollection(); + } + }, [geometry]); // eslint-disable-line react-hooks/exhaustive-deps + + return ( + <> +
    +
    +

    Center Lat: {lat}

    +

    Center Long: {lng}

    +

    Current Zoom: {zoom}

    +
    +
    +

    Attractions Nearby:

    +
    + +
    + {places.map((place, index) => ( +
    + handleClick(place)}> + {place.properties.title} + +
    + {place.properties.distance.toFixed(2)} {units} away +
    +
    + ))} +
    +
    +
    + + ); +} + +export default App; +``` + + - To understand how the app works, let's break down this monster component: + +7. **Create the last helper function** + + - Create `src/helpers/getBbox.js`. Copy and paste in the following code: + +```js +export function getBbox(sortedEvents, locationLng, locationLat) { + const lons = [ + sortedEvents[0].geometry.coordinates[0], + locationLng, + ]; + const lats = [ + sortedEvents[0].geometry.coordinates[1], + locationLat, + ]; + const sortedLons = lons.sort((a, b) => { + if (a > b) { + return 1; + } + if (a.distance < b.distance) { + return -1; + } + return 0; + }); + const sortedLats = lats.sort((a, b) => { + if (a > b) { + return 1; + } + if (a.distance < b.distance) { + return -1; + } + return 0; + }); + return [ + [sortedLons[0], sortedLats[0]], + [sortedLons[1], sortedLats[1]], + ]; +} +``` + +8. **Run your app!** + + - Replace your `package.json` code with the following, which includes all dependencies needed to run the app: + +```json +{ + "name": "geopoly-demo", + "version": "1.0.0", + "private": true, + "description": "", + "main": "index.js", + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "create-tables": "node src/helpers/createDatabase.js" + }, + "eslintConfig": { + "extends": [ + "react-app" + ] + }, + "browserslist": [ + "defaults", + "not ie 11" + ], + "author": "", + "license": "ISC", + "type": "module", + "dependencies": { + "@mapbox/mapbox-gl-geocoder": "^5.0.2", + "@sqlitecloud/drivers": "^1.0.193", + "@turf/turf": "^7.0.0", + "mapbox-gl": "^3.5.2", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-scripts": "^5.0.1" + }, + "devDependencies": { + "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "dotenv": "^16.4.5" + } +} +``` + + - From your project dir, install the dependencies and start your local dev server. + +```bash +npm i +npm start +``` + + - Visit `http://localhost:3000/` (adjust the port as-needed) in your browser to view the application. + +9. **Find attractions near you!** + + - USE CASE 1: You used the NYC geodata fetched with the provided Overpass query. + + - On app load, the map is centered on Central Park, NYC. + + - In the geocoder (i.e. search input) at the top right of the map, enter "Empire" and select the "Empire State Building" search result. + + - When you select a geocoder result: + - a polygon is generated by Geopoly, added to your `polygons` table, and displayed on the map. + + - all attractions from your `attractions` table calculated to be inside the polygon area (outline inclusive) are listed in the left sidebar AND marked on the map. NOTE: the sidebar upsorts attractions nearest the searched location. + + - As an aside: To see the inserted polygon data, in your SQLite Cloud account dashboard's left nav, click Console. Copy, paste in, and run the following query: + +```sql +SELECT rowid, geopoly_json(_shape) FROM polygons; +``` + - `geopoly_json()` parses the Array(buffer) data into an array of coordinate pairs representing the polygon vertices. The array should contain (1 + # of polygon sides) coordinate pairs. + + - The map will zoom in to the closest attraction to your searched location, in this case the "Empire State Building". However, you can click any attraction listing or marker to zoom in to that attraction on the map. + + - USE CASE 2: If you used a custom Overpass query to fetch geodata near your location, then after the map loads, click on the map's GeolocateControl and allow the browser to use your IP to locate you on the map. The map will fly to and center on your location. This way you will get more relevant results from the geocoder search and your polygon will contain (more) attractions. From 6516141ebca8e59183602c7355649d9de5e33814 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Wed, 7 Aug 2024 07:25:14 -0700 Subject: [PATCH 070/185] Update vector.mdx --- sqlite-cloud/platform/vector.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/platform/vector.mdx b/sqlite-cloud/platform/vector.mdx index 66ae394..da9bff6 100644 --- a/sqlite-cloud/platform/vector.mdx +++ b/sqlite-cloud/platform/vector.mdx @@ -12,7 +12,7 @@ Every SQLite Cloud database comes with the `sqlite-vec` extension pre-installed. Using sqlite-vec is similar to using full-text search in SQLite. Declare a "virtual table" with vector columns, insert data with normal INSERT INTO statements, and query with normal SELECT statements. -`sqlite-vec` is currently built and optimized for brute-force vector search. This means there is no approximate nearest neighbor search available, limiting the number of vectors that can be searched in a reasonable amount of time. +`sqlite-vec` is currently built and optimized for brute-force vector search. This means there is no approximate nearest neighbor search available at this time. ## Usage ### Create a vector table @@ -100,7 +100,7 @@ insert into vec_items_slim ``` ## Performance considerations -Free SQLite Cloud plans are not optimized for vector workloads. To speak to the team about upgrading your plan, [please reach out](https://www.sqlitecloud.io/support). +Free SQLite Cloud plans are not optimized for large-scale vector workloads. To speak to the team about upgrading your plan, [please reach out](https://www.sqlitecloud.io/support). ## Next Steps Combined with [edge functions](/docs/edge-functions), SQLite Cloud's vector search capabilities make it a great choice for serverless RAG applications. From d5e829711d7e78fa9e50ca86aa0de65e1d448e5e Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 7 Aug 2024 19:17:28 -0400 Subject: [PATCH 071/185] Completed Geopoly tutorial doc --- sqlite-cloud/_nav.ts | 4 +- sqlite-cloud/tutorial-geopoly.mdx | 161 ++++++++++++++++++------------ 2 files changed, 99 insertions(+), 66 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 16f2307..a7a563b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -21,7 +21,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, { title: "Tutorials", type: "inner", level: 0 }, - { title: "SQLite Spotlight: Geopoly Extension", filePath: "tutorial-geopoly", type: "inner", level: 1 }, + { title: "Using SQLite Extensions - Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, @@ -143,7 +143,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, { title: "Tutorials", type: "inner", level: 1 }, - { title: "SQLite Spotlight: Geopoly Extension", ref: "/docs/tutorial-geopoly", type: "inner", level: 2 }, + { title: "Using SQLite Extensions - Geopoly", ref: "/docs/tutorial-geopoly", type: "inner", level: 2 }, { title: "Classes", type: "inner", level: 1 }, { title: "Database", filePath: 'sqlite-cloud/sdks/js/classes/Database', type: "inner", level: 2 }, { title: "SQLiteCloudConnection", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, diff --git a/sqlite-cloud/tutorial-geopoly.mdx b/sqlite-cloud/tutorial-geopoly.mdx index b537342..59669ad 100644 --- a/sqlite-cloud/tutorial-geopoly.mdx +++ b/sqlite-cloud/tutorial-geopoly.mdx @@ -1,26 +1,20 @@ --- -title: SQLite Spotlight - Geopoly Extension +title: Using SQLite Extensions - Geopoly description: Build a local attractions finder app using SQLite Cloud, SQLite's built-in Geopoly extension, Mapbox, and React. category: getting-started status: publish slug: tutorial-geopoly --- -This tutorial demonstrates how to build a local attractions finder app. The app uses: -- GeoJSON data -- a SQLite Cloud database -- Mapbox JavaScript Graphics Library (GL JS) - - user has to create an account/ get a token! -- React -- SQLite's built-in Geopoly extension +In this tutorial you will build a local attractions finder map-plication using GeoJSON data, a SQLite Cloud database, [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/guides) (JavaScript Graphics Library), React, and SQLite's built-in [Geopoly extension](https://devdocs.io/sqlite/geopoly). -Time to complete: ~15-20 mins. +**Time to complete: 15-20 mins.** -If you get stuck in the tutorial or prefer to play with the finished product, check out [the example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly). +If you get stuck in the tutorial or prefer to play with the finished product, check out [the example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly-demo). --- -1. **Initialize your app** +**1. Initialize your app** - Create a new directory `sqlc-geopoly-demo`. From this directory, bootstrap a Node.js project. ```bash @@ -29,11 +23,11 @@ cd sqlc-geopoly-demo npm init -y ``` -2. **Curate your GeoJSON data** +**2. Curate your GeoJSON data** - - We will leverage the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) (an open-source, read-only API for fetching OpenStreetMap data) to query NYC attractions. + - We will leverage the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) (an open-source, read-only API for fetching OpenStreetMap data) to query NY attractions. - - Visit [Overpass Turbo](https://overpass-turbo.eu/), the Overpass GUI. Copy and paste in the below query which: + - Visit [Overpass Turbo](https://overpass-turbo.eu/), the Overpass GUI. Copy and paste in the below query, which: - defines New York as the area of interest; - fetches nodes in the specified area that are tagged with the keys `amenity`, `historic`, `tourism`, `leisure`, etc.; and - outputs the data. @@ -67,9 +61,7 @@ out skel qt; - Click Export. Under Data, copy the GeoJSON. - - Use [a JSON formatter](https://jsonformatter.org/) to correctly format the copied JSON. - - - Back in your project dir, create `data/geodata.json`. Paste the formatted GeoJSON into the file. It should look as follows: + - Back in your project dir, create `data/geodata.json`. Paste the formatted GeoJSON into the file. It should look similar to the following: ```json { @@ -110,34 +102,35 @@ out skel qt; ] } ``` + - For this tutorial, we'll use the NY geodata. Once you have the app up-and-running, you can run your own Overpass queries to customize the geodata per your needs. See **Additional Guidance on Overpass** at the end of this tutorial. - - To pull other types of attractions or any other kind of location data in an area of interest to you, refer to [OpenStreetMap's Map features documentation](https://wiki.openstreetmap.org/wiki/Map_features) and modify the above query's area and key-value pairs. +**3. Create a new SQLite Cloud database** - - NOTE: The app currently only works with Point features (represented in the [doc's](https://wiki.openstreetmap.org/wiki/Map_features) Element column by an icon containing a dot), so be sure to query only: - - nodes, and - - the key-value pairs that can return Point data. For example, don't use most values available for the Boundary key. + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. - - To implement more complex or granular Point queries, refer to the [Overpass QL documentation](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL). + - In your account dashboard's left nav, click Databases, then Create Database. Name your new database `geopoly-demo`. -3. **Create a new / empty SQLite Cloud database** +**4. Create a Mapbox account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - [Sign up](https://account.mapbox.com/auth/signup/) for an Individual Mapbox account. (We'll stay on the free tier.) - - In your account dashboard's left nav, click Databases, then the Create Database button. To minimize code changes, name your new database `geopoly-demo`. +**5. Set your environment variables** -4. **Set an environment variable** + - In your project dir, create a `.env` file. + - This app will use `react-scripts`, which leverages Create React App under-the-hood. Create React App offers built-in support for env vars. You will not need to manually configure `webpack` or another bundler, but all vars will need to be prefixed with `REACT_APP_`. - - In your project dir, create a `.env` file with a new environment variable `REACT_APP_CONNECTION_STRING`. Copy your connection string from your account dashboard and assign it to the variable. - - CONTEXT: This app will use `react-scripts`, which leverages Create React App under-the-hood. Create React App offers built-in support for env vars. You will not need to manually configure `webpack` or another bundler, but all vars must be prefixed with `REACT_APP_`. + - Add 2 env vars to the file: + - `REACT_APP_CONNECTION_STRING`. Copy and paste your connection string from your SQLite Cloud account dashboard. + - `REACT_APP_MAPBOX_TOKEN`. In your Mapbox account dashboard's nav, click Tokens. Copy and paste your default public token. - - Install the SQLite Cloud JS SDK and dotenv package as dependencies: + - Install the SQLite Cloud JS SDK and `dotenv` package as dependencies: ```bash npm i @sqlitecloud/drivers npm i -D dotenv ``` -5. **Create your DB tables** +**6. Create your database tables** - In your project dir, create `src/helpers/createDatabase.js`. Copy and paste in the following code: @@ -175,32 +168,31 @@ createDatabase(); ``` - The `createDatabase` function: - - connects to your `geopoly-demo` database - - creates a virtual Geopoly table with 2 columns: `rowid` (which does not display in SQLite Cloud's Console but can be queried) and `_shape` - - creates an `attractions` table with 5 columns: `id`, `name`, `lng`, `lat`, and `coordinates` - - populates the `attractions` table using the GeoJSON FeatureCollection you generated earlier - - closes the database connection. + - connects to your `geopoly-demo` database; + - creates a virtual `polygons` table with 2 columns: `rowid` and `_shape`; + - creates an `attractions` table with 5 columns: `id`, `name`, `lng`, `lat`, and `coordinates`; and + - populates the `attractions` table using the GeoJSON FeatureCollection in `geodata.json`. - - Add the following script to your `package.json`: + - Add the following to your `package.json`: ```json "scripts": { "create-tables": "node src/helpers/createDatabase.js" -} +}, +"type": "module", ``` - Run `npm run create-tables`. - - The time it will take for the command to finish creating tables and inserting the geodata will depend on the size of your FeatureCollection. The example Overpass query provided above returns ~2000 NYC Point features and takes a couple of minutes. + - The time it will take for the command to finish creating the tables and inserting the geodata will depend on the size of your FeatureCollection. The NY Overpass query returns ~2000 Point features, so row insertion takes a couple of minutes. - - As an aside: To see the inserted attractions geodata, in your SQLite Cloud account dashboard's left nav, click Console. Copy, paste in, and run the following query: + - To see the inserted NY attractions geodata, in your SQLite Cloud account dashboard's left nav, click Console. In the database dropdown, select `geopoly-demo`. Copy, paste in, and run the following query: ```sql SELECT * FROM attractions ORDER BY id DESC; ``` - - If you used the provided Overpass query, ~2000 rows are added. -6. **Setup the frontend** +**7. Set up the frontend** - In your project dir, create `public/index.html`. Copy and paste in the following code: @@ -214,7 +206,7 @@ SELECT * FROM attractions ORDER BY id DESC; name="description" content="Create a React web app that uses Mapbox GL JS to render a map" /> - Local Attraction Finder + Local Attractions Finder @@ -223,7 +215,7 @@ SELECT * FROM attractions ORDER BY id DESC; ``` - - In the `src` dir, add 3 files: `index.css` (for app styling), `index.js` (the app entrypoint file), and `App.js` (the one-and-only component). Copy and paste in the following code for each file: + - In the `src` dir, add 3 files: `index.css` (for app styling), `index.js` (the app entrypoint file), and `App.js` (the app's sole component). Copy and paste in the following code for each file: `index.css` ```css @@ -340,8 +332,8 @@ body { .marker { border: none; cursor: pointer; - width: 26px; - height: 34px; + width: 32px; + height: 40px; background-image: url('https://docs.mapbox.com/mapbox-gl-js/assets/custom_marker.png'); } @@ -360,7 +352,7 @@ body { } ``` - - NOTE: To simplify this tutorial, `.marker.background-image` uses a custom Mapbox marker for the map pins marking attractions. [The example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly) uses a custom marker image included in the repo's `images` dir (excluded here). + - NOTE: To simplify this tutorial, `.marker.background-image` uses a custom Mapbox marker for the pins marking attractions on the map. [The example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly) uses a custom marker image included in the repo's `images` dir (excluded here). `index.js` ```js @@ -389,8 +381,7 @@ import { point, distance } from '@turf/turf'; import { Database } from '@sqlitecloud/drivers'; import { getBbox } from './helpers/getBbox.js'; -mapboxgl.accessToken = - 'pk.eyJ1IjoidW5hdGFyYWphbiIsImEiOiJjbDFpcW82MGYxeDE1M2RwNjU4MmZ1YndsIn0.HyxwEtZz-pQ_7R6e48l0-g'; +mapboxgl.accessToken = process.env.REACT_APP_MAPBOX_TOKEN; function App() { const mapContainerRef = useRef(); @@ -682,9 +673,29 @@ function App() { export default App; ``` - - To understand how the app works, let's break down this monster component: + - To understand how the app works, let's break down this monster component's core functionality: + + - The first `useEffect`: + - creates, styles, and centers the map; + - applies 3 controls to the top right of the map: a geocoder (i.e. address search input), an icon to toggle the map to fullscreen mode, and an icon to locate the app user on the map; + - sets an event listener to track the map center coordinates and zoom level, all displayed on the top left of the app; and + - sets an event listener on the geocoder to call the `queryGeopoly` function when the user clicks a geocoder result. + + - The `queryGeopoly` function: + - connects to your `geopoly-demo` database; + - uses the `geopoly_regular` function to generate a polygon and adds it to the `polygons` table (set a positive `radius` and up to 1000 `sides`); + - returns all named attractions in the polygon area; + - uses Turf.js to calculate the distance between the searched location and each attraction (set `units` to be miles or kilometers); + - applies clickable markers for all attractions on the map; + - upsorts attractions nearest the user's searched location; + - uses the `getBbox` helper function (defined in the next step) to zoom the map to the attraction nearest the searched location; and + - updates the `geometry` state to hold the returned Polygon and attraction Point features. + + - The second `useEffect`: + - is triggered by the `geometry` state update; and + - calls the `drawFeatureCollection` function to draw the returned Polygon, its outline, and attraction Points on the map. -7. **Create the last helper function** +**8. Create a helper function** - Create `src/helpers/getBbox.js`. Copy and paste in the following code: @@ -723,13 +734,17 @@ export function getBbox(sortedEvents, locationLng, locationLat) { } ``` -8. **Run your app!** + - The `getBbox` function: + - generates a bounding box, defined by a southwest coordinate pair and northeast coordinate pair; and + - is used in `queryGeopoly` to fit/ zoom the map view to a user's searched location and its nearest attraction. + +**9. Run your app!** - Replace your `package.json` code with the following, which includes all dependencies needed to run the app: ```json { - "name": "geopoly-demo", + "name": "sqlc-geopoly-demo", "version": "1.0.0", "private": true, "description": "", @@ -774,28 +789,46 @@ npm i npm start ``` - - Visit `http://localhost:3000/` (adjust the port as-needed) in your browser to view the application. + - Visit `http://localhost:3000/` (adjust the port as-needed) in your browser to view the app. -9. **Find attractions near you!** +**10. Find attractions!** - - USE CASE 1: You used the NYC geodata fetched with the provided Overpass query. + - On app load, the map is centered on Central Park, NY. - - On app load, the map is centered on Central Park, NYC. + - In the geocoder (i.e. search input) at the top right of the map, enter "Empire" and click on the "Empire State Building" result. You can also search coordinates (see [reverse geocoding](https://docs.mapbox.com/api/search/geocoding/)). - - In the geocoder (i.e. search input) at the top right of the map, enter "Empire" and select the "Empire State Building" search result. + - When you select a geocoder result: + - a polygon is generated by Geopoly, added to your `polygons` table, and displayed on the map; and - - When you select a geocoder result: - - a polygon is generated by Geopoly, added to your `polygons` table, and displayed on the map. + - all attractions in your `attractions` table inside the polygon area are listed in the left sidebar AND marked on the map. NOTE: the sidebar upsorts attractions nearest your searched location, in this case the "Empire State Building". - - all attractions from your `attractions` table calculated to be inside the polygon area (outline inclusive) are listed in the left sidebar AND marked on the map. NOTE: the sidebar upsorts attractions nearest the searched location. + - To see the inserted polygon data, in your SQLite Cloud account dashboard's left nav, click Console. In the database dropdown, select `geopoly-demo`. Copy, paste in, and run the following query. - - As an aside: To see the inserted polygon data, in your SQLite Cloud account dashboard's left nav, click Console. Copy, paste in, and run the following query: + - The `geopoly_json` function parses the `_shape` column's `[object ArrayBuffer]` data into an array of coordinate pairs representing the polygon's vertices: `[[-73.9355,40.7485],[-73.9359,40.7547], ...,[-73.9359,40.7422],[-73.9355,40.7485]]`. The array should contain (1 + # of polygon sides) coordinate pairs. The polygon is closed, so the first and last pairs both represent the same vertex. ```sql SELECT rowid, geopoly_json(_shape) FROM polygons; ``` - - `geopoly_json()` parses the Array(buffer) data into an array of coordinate pairs representing the polygon vertices. The array should contain (1 + # of polygon sides) coordinate pairs. - - The map will zoom in to the closest attraction to your searched location, in this case the "Empire State Building". However, you can click any attraction listing or marker to zoom in to that attraction on the map. + - The map zooms in to the nearest attraction to your searched location and highlights its corresponding top listing in the sidebar. + + - You can click on any attraction listing or marker to fly/ zoom to and center on that attraction on the map. + + - Turf.js calculates straight-line distances between your searched location and each attraction. Expect discrepancies between this app's calculated distances vs, say, Google or Apple Maps. + +And that’s it! You’ve successfully built a local attractions finder app that utilizes Geopoly to write geodata to and read from a SQLite Cloud database. + +### Additional Guidance on Overpass: + - To fetch other attractions or any other kind of location data in NY or another area of interest to you, refer to [OpenStreetMap's Map features documentation](https://wiki.openstreetmap.org/wiki/Map_features). As a starting point, modify the area or key-value pairs in the NY query. - - USE CASE 2: If you used a custom Overpass query to fetch geodata near your location, then after the map loads, click on the map's GeolocateControl and allow the browser to use your IP to locate you on the map. The map will fly to and center on your location. This way you will get more relevant results from the geocoder search and your polygon will contain (more) attractions. + - NOTE: The app works only with Point features (represented in the [Map features](https://wiki.openstreetmap.org/wiki/Map_features) tables' `Element` columns by an icon with a single dot). Be sure to query only nodes and the key-value pairs that can return Point data. For example, don't use most of the values available for the Boundary key. + + - To implement more complex or granular Point queries, refer to the [Overpass QL documentation](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL). + + - If you run a custom Overpass query: + - Add to or replace the FeatureCollection in `geodata.json`. + - In your SQLite Cloud account dashboard's left nav, click Databases. In the `geopoly-demo` row, click the down chevron and then Delete Database. + - Create Database with the same name. + - From your project dir, run `npm run create-tables`. Your database tables will be re-created, and the `attractions` table will be populated with your updated geodata. + + - If you queried and stored attractions near your location, then after the app's initial load, click on the [GeolocateControl icon](https://docs.mapbox.com/mapbox-gl-js/example/locate-user/) at the top right of the map and allow the browser to quickly center the map on your location. Search away! \ No newline at end of file From 614909970ef05341cdc75b8fa9f73f8faa791d36 Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Thu, 8 Aug 2024 10:55:07 +0200 Subject: [PATCH 072/185] added set database key hyperlink --- sqlite-cloud/reference/backup-commands.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/reference/backup-commands.mdx b/sqlite-cloud/reference/backup-commands.mdx index 66d8666..3ee1271 100644 --- a/sqlite-cloud/reference/backup-commands.mdx +++ b/sqlite-cloud/reference/backup-commands.mdx @@ -7,7 +7,7 @@ slug: backup-commands --- ## APPLY BACKUP SETTINGS -Several backup-related settings can be applied using the SET DATABASE KEY command. +Several backup-related settings can be applied using the [SET DATABASE KEY](https://docs.sqlitecloud.io/docs/settings-commands#set-database-key) command. The following keys affect the backup settings: * **backup**: set to 1 to activate a backup, 0 to disable. From 0a7f147926c25fa589dea97acb68517d74b933f3 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:04:37 -0400 Subject: [PATCH 073/185] Shifted code explanations to be comments --- sqlite-cloud/tutorial-geopoly.mdx | 65 ++++++++++++++----------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/sqlite-cloud/tutorial-geopoly.mdx b/sqlite-cloud/tutorial-geopoly.mdx index 59669ad..9bb5d21 100644 --- a/sqlite-cloud/tutorial-geopoly.mdx +++ b/sqlite-cloud/tutorial-geopoly.mdx @@ -140,15 +140,19 @@ import 'dotenv/config'; import geodata from '../../data/geodata.json' assert { type: 'json' }; async function createDatabase() { + // open a connection to your `geopoly-demo` database const db = new Database(process.env.REACT_APP_CONNECTION_STRING); const db_name = 'geopoly-demo'; await db.sql`USE DATABASE ${db_name};`; + // create a table with 2 columns: `rowid` and `_shape` await db.sql`CREATE VIRTUAL TABLE polygons USING geopoly()`; + // create a table with 5 columns: `id`, `name`, `lng`, `lat`, and `coordinates` await db.sql`CREATE TABLE attractions (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, lng REAL NOT NULL, lat REAL NOT NULL, coordinates TEXT NOT NULL)`; + // populate the `attractions` table using the GeoJSON FeatureCollection in `geodata.json` for (const feature of geodata['features']) { const { name } = feature.properties; const { coordinates } = feature.geometry; @@ -166,12 +170,6 @@ async function createDatabase() { createDatabase(); ``` - - - The `createDatabase` function: - - connects to your `geopoly-demo` database; - - creates a virtual `polygons` table with 2 columns: `rowid` and `_shape`; - - creates an `attractions` table with 5 columns: `id`, `name`, `lng`, `lat`, and `coordinates`; and - - populates the `attractions` table using the GeoJSON FeatureCollection in `geodata.json`. - Add the following to your `package.json`: @@ -397,21 +395,25 @@ function App() { const units = 'miles'; async function queryGeopoly(searchedLng, searchedLat) { + // open a connection to your `geopoly-demo` database const db = new Database(process.env.REACT_APP_CONNECTION_STRING); const db_name = 'geopoly-demo'; - const radius = 0.05; - const sides = 50; + const radius = 0.05; // must be a positive number + const sides = 50; // 3-1000 + // generate a new polygon to be added to your `polygons` table const polygonCoords = await db.sql`USE DATABASE ${db_name}; INSERT INTO polygons(_shape) VALUES(geopoly_regular(${searchedLng}, ${searchedLat}, ${radius}, ${sides})) RETURNING geopoly_json(_shape);`; + // point-in-polygon query to get all attractions in the generated polygon's area const attractionsInPolygon = await db.sql`USE DATABASE ${db_name}; SELECT name, coordinates FROM attractions WHERE geopoly_contains_point(${polygonCoords[0]['geopoly_json(_shape)']}, lng, lat);`; db.close(); + // remove unnamed attractions const namedAttractions = attractionsInPolygon.filter( (attraction) => attraction.name !== null ); @@ -428,16 +430,18 @@ function App() { properties: { id: index, title: attraction['name'], + // use Turf.js to calculate the distance between the searched location and the current attraction distance: distance( point([searchedLng, searchedLat]), point(attractionCoordinates), { - units, + units, // either miles or kilometers } ), }, }; + // apply clickable markers for all attractions const marker = document.createElement('div'); marker.key = `marker-${attractionFeature.properties.id}`; marker.id = `marker-${attractionFeature.properties.id}`; @@ -454,6 +458,7 @@ function App() { return attractionFeature; }); + // upsort attractions nearest the user's searched location attractionFeatures.sort((a, b) => { if (a.properties.distance > b.properties.distance) { return 1; @@ -466,6 +471,7 @@ function App() { setPlaces(attractionFeatures); + // use a helper function (defined in the next step) to fit/ zoom the map view to the searched location and its nearest attraction if (attractionFeatures[0]) { const bbox = getBbox(attractionFeatures, searchedLng, searchedLat); mapRef.current.fitBounds(bbox, { @@ -484,6 +490,7 @@ function App() { .addTo(mapRef.current); } + // update the `geometry` state to hold the returned Polygon and attraction Point features setGeometry([ { type: 'Feature', @@ -566,6 +573,7 @@ function App() { } useEffect(() => { + // create, style, and center the map mapRef.current = new mapboxgl.Map({ container: mapContainerRef.current, style: 'mapbox://styles/mapbox/streets-v12', @@ -573,16 +581,20 @@ function App() { zoom, }); + // apply 3 controls to the top right of the map + // an address search input const geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken, mapboxgl, zoom: 12, }); + // toggle fullscreen mode const fullscreenCtrl = new mapboxgl.FullscreenControl({ container: mapContainerRef.current, }); + // locate the user on the map const geolocateCtrl = new mapboxgl.GeolocateControl({ fitBoundsOptions: { maxZoom: 12, @@ -597,6 +609,7 @@ function App() { mapRef.current.addControl(fullscreenCtrl); mapRef.current.addControl(geolocateCtrl); + // track the map center coordinates and zoom level (displayed on the top left of the app) function updateCoordinates() { const { lng, lat } = mapRef.current.getCenter(); setLng(lng.toFixed(4)); @@ -606,6 +619,7 @@ function App() { mapRef.current.on('move', updateCoordinates); + // call the `queryGeopoly` function when the user clicks a geocoder result geocoder.on('result', (e) => { const existingMarkers = document.getElementsByClassName('marker'); while (existingMarkers[0]) { @@ -630,8 +644,10 @@ function App() { }; }, []); // eslint-disable-line react-hooks/exhaustive-deps + // triggered by a `geometry` state update useEffect(() => { if (geometry.length !== 0) { + // draw the returned Polygon, its outline, and attraction Points on the map drawFeatureCollection(); } }, [geometry]); // eslint-disable-line react-hooks/exhaustive-deps @@ -673,28 +689,6 @@ function App() { export default App; ``` - - To understand how the app works, let's break down this monster component's core functionality: - - - The first `useEffect`: - - creates, styles, and centers the map; - - applies 3 controls to the top right of the map: a geocoder (i.e. address search input), an icon to toggle the map to fullscreen mode, and an icon to locate the app user on the map; - - sets an event listener to track the map center coordinates and zoom level, all displayed on the top left of the app; and - - sets an event listener on the geocoder to call the `queryGeopoly` function when the user clicks a geocoder result. - - - The `queryGeopoly` function: - - connects to your `geopoly-demo` database; - - uses the `geopoly_regular` function to generate a polygon and adds it to the `polygons` table (set a positive `radius` and up to 1000 `sides`); - - returns all named attractions in the polygon area; - - uses Turf.js to calculate the distance between the searched location and each attraction (set `units` to be miles or kilometers); - - applies clickable markers for all attractions on the map; - - upsorts attractions nearest the user's searched location; - - uses the `getBbox` helper function (defined in the next step) to zoom the map to the attraction nearest the searched location; and - - updates the `geometry` state to hold the returned Polygon and attraction Point features. - - - The second `useEffect`: - - is triggered by the `geometry` state update; and - - calls the `drawFeatureCollection` function to draw the returned Polygon, its outline, and attraction Points on the map. - **8. Create a helper function** - Create `src/helpers/getBbox.js`. Copy and paste in the following code: @@ -727,6 +721,8 @@ export function getBbox(sortedEvents, locationLng, locationLat) { } return 0; }); + + // return a bounding box, defined by a southwest coordinate pair and northeast coordinate pair return [ [sortedLons[0], sortedLats[0]], [sortedLons[1], sortedLats[1]], @@ -734,10 +730,6 @@ export function getBbox(sortedEvents, locationLng, locationLat) { } ``` - - The `getBbox` function: - - generates a bounding box, defined by a southwest coordinate pair and northeast coordinate pair; and - - is used in `queryGeopoly` to fit/ zoom the map view to a user's searched location and its nearest attraction. - **9. Run your app!** - Replace your `package.json` code with the following, which includes all dependencies needed to run the app: @@ -814,11 +806,12 @@ SELECT rowid, geopoly_json(_shape) FROM polygons; - You can click on any attraction listing or marker to fly/ zoom to and center on that attraction on the map. - - Turf.js calculates straight-line distances between your searched location and each attraction. Expect discrepancies between this app's calculated distances vs, say, Google or Apple Maps. + - [Turf.js uses the Haversine formula](https://turfjs.org/docs/api/distance) to account for global curvature when calculating the distance between your searched location and each attraction. However, you should still expect discrepancies between this app's calculated distances vs, say, Google or Apple Maps. And that’s it! You’ve successfully built a local attractions finder app that utilizes Geopoly to write geodata to and read from a SQLite Cloud database. ### Additional Guidance on Overpass: + - To fetch other attractions or any other kind of location data in NY or another area of interest to you, refer to [OpenStreetMap's Map features documentation](https://wiki.openstreetmap.org/wiki/Map_features). As a starting point, modify the area or key-value pairs in the NY query. - NOTE: The app works only with Point features (represented in the [Map features](https://wiki.openstreetmap.org/wiki/Map_features) tables' `Element` columns by an icon with a single dot). Be sure to query only nodes and the key-value pairs that can return Point data. For example, don't use most of the values available for the Boundary key. From 4b89b31122c2aa17ec1dd72ba510941699de1d65 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:54:16 -0400 Subject: [PATCH 074/185] Updated index.tsx code to pass the Database instance usewebsocket: true option for app to work on iOS --- sqlite-cloud/quick-start-react-native.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 0667ed6..159b01f 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -46,9 +46,10 @@ export default function App() { useEffect(() => { async function getAlbums() { - const db = new Database( - '' - ); + const db = new Database({ + connectionstring: '', + usewebsocket: true, + }); const result = await db.sql`USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`; From fbc0a9427b38221490b03312dd5015c700ac42c5 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 19 Aug 2024 10:04:19 -0700 Subject: [PATCH 075/185] update title (#87) --- sqlite-cloud/_nav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index a7a563b..7a95e85 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -21,7 +21,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, { title: "Tutorials", type: "inner", level: 0 }, - { title: "Using SQLite Extensions - Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, + { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, From bcf5dc55a43c3b00cc86a6e1df7e553706db0181 Mon Sep 17 00:00:00 2001 From: tizianot Date: Mon, 26 Aug 2024 11:29:20 +0200 Subject: [PATCH 076/185] wip 90 --- sqlite-cloud/_nav.ts | 10 ++-- sqlite-cloud/index.mdx | 61 +++++++++++------------ sqlite-cloud/introduction.mdx | 35 ++++++++++++++ sqlite-cloud/platform/index.mdx | 83 ++++++++++++++++++++++++++++++++ sqlite-cloud/reference/index.mdx | 35 ++++++++++++++ sqlite-cloud/sdks/index.mdx | 53 ++++++++++++++++++++ 6 files changed, 242 insertions(+), 35 deletions(-) create mode 100644 sqlite-cloud/introduction.mdx create mode 100644 sqlite-cloud/platform/index.mdx create mode 100644 sqlite-cloud/reference/index.mdx create mode 100644 sqlite-cloud/sdks/index.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 7a95e85..f7955e2 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -2,8 +2,8 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, - { title: "Getting Started", type: "secondary", icon: "docs-star" }, - { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav + { title: "Getting Started", filePath:"getting-started", type: "secondary", icon: "docs-star" }, + { title: "Introduction", filePath:"introduction", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav { title: "Fundamentals", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, @@ -23,7 +23,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Tutorials", type: "inner", level: 0 }, { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, - { title: "Platform", type: "secondary", icon: "docs-plat" }, + { title: "Platform", filePath:"platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, @@ -38,7 +38,7 @@ const sidebarNav: SidebarNavStruct = [ // { title: "Partitioning", type: "inner", level: 0 }, { title: "Settings", filePath: "settings", type: "inner", level: 0 }, - { title: "SDKs", type: "secondary", icon: "docs-sdk" }, + { title: "SDKs", filePath:"sdks", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, { title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, }, { title: 'Basic APIs', type: "inner", level: 1 }, @@ -173,7 +173,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Swift", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 }, - { title: "Reference", type: "secondary", icon: "docs-ref" }, + { title: "Reference", filePath:"reference", type: "secondary", icon: "docs-ref" }, { title: "Server-side Commands", type: "inner", level: 0 }, { title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 }, { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index ee4cd6d..3095cd2 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -1,34 +1,35 @@ --- -title: Introduction to SQLite Cloud -description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +title: Getting Started +description: Index page for getting started section category: getting-started status: publish +icon: docs-star +slug: getting-started --- - -## Overview -**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. - -It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. - -**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. - ---- - -## Architecture - -**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. - -**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. - -In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. - -## Features -SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. -* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. -* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. -* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. -* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + +export const sections = [ + { + icon: "curvedArrow", + title: "Introduction", + description: "SQLite Cloud introduction and getting started guide.", + href: "/docs/introduction", + }, + { + icon: "twoColsGrid", + title: "Fundamentals", + description: "Learn how to connect to a cluster and start using SQLite Cloud.", + href: "/docs/connect-cluster", + }, + { + icon: "puzzle", + title: "Quick start guide", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/quick-start-cdn", + } +] + + + \ No newline at end of file diff --git a/sqlite-cloud/introduction.mdx b/sqlite-cloud/introduction.mdx new file mode 100644 index 0000000..04228a3 --- /dev/null +++ b/sqlite-cloud/introduction.mdx @@ -0,0 +1,35 @@ +--- +title: Introduction to SQLite Cloud +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: getting-started +status: publish +slug: introduction +--- + +## Overview +**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. + +It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. + +**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. + +--- + +## Architecture + +**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. + +**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. + +In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. + +## Features +SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. +* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). +* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). +* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. +* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. +* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. +* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. +* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. diff --git a/sqlite-cloud/platform/index.mdx b/sqlite-cloud/platform/index.mdx new file mode 100644 index 0000000..ec07706 --- /dev/null +++ b/sqlite-cloud/platform/index.mdx @@ -0,0 +1,83 @@ +--- +title: Platform +description: Index page for platform section +category: platform +status: publish +icon: docs-plat +slug: platform +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + +export const sections = [ + { + icon: "puzzle", + title: "Edge Functions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/edge-functions", + }, + { + icon: "puzzle", + title: "Webhooks", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/webhooks", + }, + { + icon: "puzzle", + title: "Pub/Sub", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/pub-sub", + }, + { + icon: "puzzle", + title: "Vector", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/vector", + }, + { + icon: "puzzle", + title: "Scaling", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/scaling", + }, + { + icon: "puzzle", + title: "Security and Access Control", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/security", + }, + { + icon: "puzzle", + title: "Backups", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/backups", + }, + { + icon: "puzzle", + title: "Query Analyzer", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/analyzer", + }, + { + icon: "puzzle", + title: "Extensions", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/extensions", + }, + { + icon: "puzzle", + title: "Weblite", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/weblite", + }, + { + icon: "puzzle", + title: "Settings", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/settings", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/reference/index.mdx b/sqlite-cloud/reference/index.mdx new file mode 100644 index 0000000..f6669b2 --- /dev/null +++ b/sqlite-cloud/reference/index.mdx @@ -0,0 +1,35 @@ +--- +title: Reference +description: Index page for reference section +category: reference +status: publish +icon: docs-ref +slug: reference +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + +export const sections = [ + { + icon: "curvedArrow", + title: "Server-side Commands", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/server-side-commands", + }, + { + icon: "twoColsGrid", + title: "CLI", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/cli-commands", + }, + { + icon: "sqlite-stacked", + title: "SQLite", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sqlite", + }, +] + + + \ No newline at end of file diff --git a/sqlite-cloud/sdks/index.mdx b/sqlite-cloud/sdks/index.mdx new file mode 100644 index 0000000..0556522 --- /dev/null +++ b/sqlite-cloud/sdks/index.mdx @@ -0,0 +1,53 @@ +--- +title: SDKs +description: Index page for sdks section +category: sdks +status: publish +icon: docs-sdks +slug: sdks +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + +export const sections = [ + { + icon: "docsSdkC", + title: "C/C++", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-c-introduction", + }, + { + icon: "docsSdkJs", + title: "JavaScript", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-js-introduction", + }, + { + icon: "docsSdkPython", + title: "Python", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-python-introduction", + }, + { + icon: "docsSdkGo", + title: "Go", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-go-introduction", + }, + { + icon: "docsSdkPhp", + title: "PHP", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-php-introduction", + }, + { + icon: "docsSdkSwift", + title: "Swift", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/sdk-swift-introduction", + }, +] + + + \ No newline at end of file From 9036a6de8a4bb326f14735a1ad24b64a9829fe53 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 28 Aug 2024 00:51:31 -0400 Subject: [PATCH 077/185] Completed first working draft of SQLAlchemy Quickstart --- sqlite-cloud/_nav.ts | 2 + .../quick-start-fastapi-sqlalchemy.mdx | 195 ++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 7a95e85..e455174 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -17,6 +17,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, @@ -162,6 +163,7 @@ const sidebarNav: SidebarNavStruct = [ { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, + { title: "SQLAlchemy", ref: "/docs/quick-start-sqlalchemy-orm", type: "inner", level: 1 }, { title: "Go", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-go-introduction", level: 1 }, diff --git a/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx b/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx new file mode 100644 index 0000000..e8aa176 --- /dev/null +++ b/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx @@ -0,0 +1,195 @@ +--- +title: SQLAlchemy ORM Quick Start Guide +description: Get started with SQLite Cloud using SQLAlchemy ORM in FastAPI. +category: getting-started +status: publish +slug: quick-start-sqlalchemy-orm +--- + +In this quickstart, we will show you how to get started with SQLite Cloud and SQLAlchemy by building a FastAPI backend that connects to and reads from a SQLite Cloud database. + +--- + +1. **Set up a SQLite Cloud account** + - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +2. **Create a new Python project** + - You should have the latest Python version (3) installed locally. + +```bash +mkdir sqlalchemy-quickstart +cd sqlalchemy-quickstart + +# open the project in VSCode +# code . + +python3 -m venv .venv +. .venv/bin/activate +``` + +3. **Install dependencies** + - Run this command from your current directory: + +```bash +pip install "fastapi[standard]" sqlalchemy sqlalchemy-sqlitecloud +``` + + - Do NOT remove the quotes around the FastAPI package. + - `sqlalchemy-sqlitecloud` includes `sqlitecloud`, so no need to install the latter separately. + - Update `.venv/lib/python{version}/site-packages/sqlitecloud/__init__.py`: + +```py +from .dbapi2 import * + +# from .dbapi2 import ( +# PARSE_COLNAMES, +# ... +# ) +``` + +4. **App setup** + - From your current directory, create a sub-directory `fastapi_sqlc_app` with an empty `__init__.py` file to indicate the new sub-dir is a package. + - NOTE: Create the remaining project files in this sub-dir as well. + +```bash +mkdir fastapi_sqlc_app +cd fastapi_sqlc_app +touch __init__.py +``` + + - Create a new file `database.py` and copy in the following code. + - In your SQLite Cloud account dashboard, click on `Show connection strings`, copy the Connection String, and replace `` below. Modify your string to include the name of the DB we'll query: `sqlitecloud://{hostname}:8860/chinook.sqlite?apikey={apikey}`. + +```py +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.declarative import declarative_base + +engine = create_engine('') + +SessionLocal = sessionmaker(bind=engine) + +Base = declarative_base() +``` + + - Create a new file `models.py` and copy in the following code defining 2 SQLAlchemy ORM "models", or classes, to interact with the DB. + - `__tablename__` is the name of a model's corresponding DB table. + - Most class attributes/ table `Column`s below are passed a class type as the first argument. NOTE: The `Album` class' `id` attribute passes `AlbumId` as the first arg. + - We use the `relationship` function to create an explicit, bidirectional link between the 2 models. Let's say: + - We have an instance of the `Artist` class called `taylor_swift`. Accessing the attribute `taylor_swift.albums` would return: + - a list of `Album` SQLAlchemy models from the `albums` DB table, whose foreign key `ArtistId` points to the `taylor_swift` record in the `artists` table. + - Or simply put, a list of Taylor Swift's albums. + - We have an instance of the `Album` class called `fearless`. Accessing the attribute `fearless.artist` would return: + - an `Artist` SQLAlchemy model from the `artists` DB table, again using the foreign key `ArtistId` to get the right record. + - Or simply put, the creator of the album Fearless (also Taylor Swift). + +```py +from .database import Base + +from sqlalchemy import Column, ForeignKey, Integer, String +from sqlalchemy.orm import relationship + +class Artist(Base): + __tablename__ = "artists" + + ArtistId = Column(Integer, primary_key=True) + Name = Column(String) + + albums = relationship("Album", back_populates="artist") + +class Album(Base): + __tablename__ = "albums" + + id = Column("AlbumId", Integer, primary_key=True) + Title = Column(String) + ArtistId = Column(Integer, ForeignKey('artists.ArtistId')) + + artist = relationship("Artist", back_populates="albums") +``` + + - Create a new file `schemas.py` and copy in the following code defining 2 Pydantic models, or "schemas", to validate the shapes of the response data. + - NOTE: The `Album` Pydantic model checks for `ArtistName` rather than `ArtistId` defined in the `Album` SQLAlchemy model in `models.py`. + - By default, SQLAlchemy "lazy loads", i.e. it only gets relationship data from the DB when we access the model's attribute containing that data.`orm_mode = True` enables the Pydantic model to read a returned ORM (in this case, SQLAlchemy) model and include relationship data. + +```py +from pydantic import BaseModel + +class Album(BaseModel): + id: int + Title: str + ArtistName: str + + class Config: + orm_mode = True + +class Artist(BaseModel): + ArtistId: int + Name: str + albums: list[Album] = [] + + class Config: + orm_mode = True +``` + + - Create a new file `read.py` and copy in the following code creating a reusable utility function to read album data. + +```py +from . import models + +from sqlalchemy.orm import Session + +def get_albums(db: Session, skip: int = 0, num: int = 20): + return db.query(models.Album.id, models.Album.Title, models.Artist.Name.label('ArtistName')).join(models.Artist).offset(skip).limit(num).all() +``` + + - Create a new file `main.py` and copy in the following code. + - The `get_db` function handles creating and closing a new `SessionLocal` instance, or DB connection/ session, for every request. + - NOTE: The function below returns a list of SQLAlchemy `Album` models. However, only the data declared in the Pydantic schemas will be returned to the client. + +```py +from .database import SessionLocal +from . import read, schemas + +from fastapi import FastAPI, Depends +from sqlalchemy.orm import Session + +app = FastAPI() + +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() + +@app.get("/albums/", response_model=list[schemas.Album]) +def read_albums(skip: int = 0, num: int = 20, db: Session = Depends(get_db)): + albums = read.get_albums(db, skip=skip, num=num) + return albums +``` + +5. **Run your FastAPI app** + - From your `sqlalchemy-quickstart` directory, run the following command: + +```bash +uvicorn fastapi_sqlc_app.main:app --reload +``` + + - Visit `http://127.0.0.1:8000/albums/` to see your app data. + +6. **Troubleshooting** + + - If you encounter the following error, restart your IDE and re-run your app. + +```bash +AttributeError: module 'sqlitecloud.dbapi2' has no attribute 'sqlite_version_info'` +``` + +7. **References** + +If you're new to FastAPI and/or want to learn more about how to work with ORMs in FastAPI, we referenced FastAPI's [SQL Databases Tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) extensively when writing this Quickstart. + +If you're new to SQLAlchemy, refer to [their latest docs](https://docs.sqlalchemy.org/en/20/). + +And that's it! You've successfully built a FastAPI app that uses SQLAlchemy ORM to read data from a SQLite Cloud database. From bc8c01e52ee746b75caeb7b9f8696dcf2fe98793 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:31:12 -0400 Subject: [PATCH 078/185] Removed unnecessary code/ explanations in Quickstart --- .../quick-start-fastapi-sqlalchemy.mdx | 58 ++++--------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx b/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx index e8aa176..899f064 100644 --- a/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx +++ b/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx @@ -6,7 +6,7 @@ status: publish slug: quick-start-sqlalchemy-orm --- -In this quickstart, we will show you how to get started with SQLite Cloud and SQLAlchemy by building a FastAPI backend that connects to and reads from a SQLite Cloud database. +In this quickstart, we will show you how to get started with SQLite Cloud by building a FastAPI backend that connects to and reads from a SQLite Cloud database using SQLAlchemy. --- @@ -37,20 +37,10 @@ pip install "fastapi[standard]" sqlalchemy sqlalchemy-sqlitecloud - Do NOT remove the quotes around the FastAPI package. - `sqlalchemy-sqlitecloud` includes `sqlitecloud`, so no need to install the latter separately. - - Update `.venv/lib/python{version}/site-packages/sqlitecloud/__init__.py`: - -```py -from .dbapi2 import * - -# from .dbapi2 import ( -# PARSE_COLNAMES, -# ... -# ) -``` 4. **App setup** - - From your current directory, create a sub-directory `fastapi_sqlc_app` with an empty `__init__.py` file to indicate the new sub-dir is a package. - - NOTE: Create the remaining project files in this sub-dir as well. + - From your current directory, create a sub-directory `fastapi_sqlc_app` with an empty `__init__.py` file to indicate the new sub-directory is a package. + - NOTE: We will create all remaining project files in this sub-directory. ```bash mkdir fastapi_sqlc_app @@ -75,20 +65,12 @@ Base = declarative_base() - Create a new file `models.py` and copy in the following code defining 2 SQLAlchemy ORM "models", or classes, to interact with the DB. - `__tablename__` is the name of a model's corresponding DB table. - - Most class attributes/ table `Column`s below are passed a class type as the first argument. NOTE: The `Album` class' `id` attribute passes `AlbumId` as the first arg. - - We use the `relationship` function to create an explicit, bidirectional link between the 2 models. Let's say: - - We have an instance of the `Artist` class called `taylor_swift`. Accessing the attribute `taylor_swift.albums` would return: - - a list of `Album` SQLAlchemy models from the `albums` DB table, whose foreign key `ArtistId` points to the `taylor_swift` record in the `artists` table. - - Or simply put, a list of Taylor Swift's albums. - - We have an instance of the `Album` class called `fearless`. Accessing the attribute `fearless.artist` would return: - - an `Artist` SQLAlchemy model from the `artists` DB table, again using the foreign key `ArtistId` to get the right record. - - Or simply put, the creator of the album Fearless (also Taylor Swift). + - The `Album` class' `id` attribute maps to the `AlbumId` column in the `albums` table. All other class attribute names match their corresponding table column names. ```py from .database import Base from sqlalchemy import Column, ForeignKey, Integer, String -from sqlalchemy.orm import relationship class Artist(Base): __tablename__ = "artists" @@ -96,40 +78,23 @@ class Artist(Base): ArtistId = Column(Integer, primary_key=True) Name = Column(String) - albums = relationship("Album", back_populates="artist") - class Album(Base): __tablename__ = "albums" id = Column("AlbumId", Integer, primary_key=True) Title = Column(String) ArtistId = Column(Integer, ForeignKey('artists.ArtistId')) - - artist = relationship("Artist", back_populates="albums") ``` - - Create a new file `schemas.py` and copy in the following code defining 2 Pydantic models, or "schemas", to validate the shapes of the response data. - - NOTE: The `Album` Pydantic model checks for `ArtistName` rather than `ArtistId` defined in the `Album` SQLAlchemy model in `models.py`. - - By default, SQLAlchemy "lazy loads", i.e. it only gets relationship data from the DB when we access the model's attribute containing that data.`orm_mode = True` enables the Pydantic model to read a returned ORM (in this case, SQLAlchemy) model and include relationship data. + - Create a new file `schemas.py` and copy in the following code defining a Pydantic model, or "schema", to validate the shape of the response data. ```py from pydantic import BaseModel -class Album(BaseModel): +class AlbumResponse(BaseModel): id: int Title: str ArtistName: str - - class Config: - orm_mode = True - -class Artist(BaseModel): - ArtistId: int - Name: str - albums: list[Album] = [] - - class Config: - orm_mode = True ``` - Create a new file `read.py` and copy in the following code creating a reusable utility function to read album data. @@ -145,7 +110,9 @@ def get_albums(db: Session, skip: int = 0, num: int = 20): - Create a new file `main.py` and copy in the following code. - The `get_db` function handles creating and closing a new `SessionLocal` instance, or DB connection/ session, for every request. - - NOTE: The function below returns a list of SQLAlchemy `Album` models. However, only the data declared in the Pydantic schemas will be returned to the client. + - A GET request to the `/albums/` endpoint calls the `read_albums` function, which returns a list of SQLAlchemy `Album` models. The `response_model` ensures only data declared in the Pydantic schema is returned to the client. + - The `AlbumResponse` Pydantic model in `schemas.py` has `ArtistName`, as opposed to `ArtistId` defined in the `Album` SQLAlchemy model in `models.py`. + - `read_albums` calls the `get_albums` function in `read.py`. `get_albums` queries the `Album` ORM model/ `albums` DB table for the first 20 albums, and joins the `Artist` ORM model/ `artists` DB table to retrieve the `Artist.Name` (re-labeled `ArtistName`) expected by the `AlbumResponse` Pydantic model. ```py from .database import SessionLocal @@ -163,7 +130,7 @@ def get_db(): finally: db.close() -@app.get("/albums/", response_model=list[schemas.Album]) +@app.get("/albums/", response_model=list[schemas.AlbumResponse]) def read_albums(skip: int = 0, num: int = 20, db: Session = Depends(get_db)): albums = read.get_albums(db, skip=skip, num=num) return albums @@ -188,8 +155,7 @@ AttributeError: module 'sqlitecloud.dbapi2' has no attribute 'sqlite_version_inf 7. **References** -If you're new to FastAPI and/or want to learn more about how to work with ORMs in FastAPI, we referenced FastAPI's [SQL Databases Tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) extensively when writing this Quickstart. - -If you're new to SQLAlchemy, refer to [their latest docs](https://docs.sqlalchemy.org/en/20/). + - If you're new to FastAPI and/or want to learn more about how to work with ORMs in FastAPI, we referenced FastAPI's [introductory example](https://fastapi.tiangolo.com/#example) and [SQL Databases tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) extensively when writing this Quickstart. + - If you're new to SQLAlchemy, refer to [their latest docs](https://docs.sqlalchemy.org/en/20/). And that's it! You've successfully built a FastAPI app that uses SQLAlchemy ORM to read data from a SQLite Cloud database. From 52fe9cc8f0932945d08b180514feb949dc856c06 Mon Sep 17 00:00:00 2001 From: unatarajan <38731992+unatarajan@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:51:58 -0400 Subject: [PATCH 079/185] Added notes to clarify why FastAPI was used for this example --- ...lchemy.mdx => quick-start-sqlalchemy-orm.mdx} | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) rename sqlite-cloud/{quick-start-fastapi-sqlalchemy.mdx => quick-start-sqlalchemy-orm.mdx} (86%) diff --git a/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx b/sqlite-cloud/quick-start-sqlalchemy-orm.mdx similarity index 86% rename from sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx rename to sqlite-cloud/quick-start-sqlalchemy-orm.mdx index 899f064..2490c51 100644 --- a/sqlite-cloud/quick-start-fastapi-sqlalchemy.mdx +++ b/sqlite-cloud/quick-start-sqlalchemy-orm.mdx @@ -6,7 +6,12 @@ status: publish slug: quick-start-sqlalchemy-orm --- -In this quickstart, we will show you how to get started with SQLite Cloud by building a FastAPI backend that connects to and reads from a SQLite Cloud database using SQLAlchemy. +In this Quick Start, we will show you how to get started with SQLite Cloud by building a FastAPI backend that connects to and reads from a SQLite Cloud database using SQLAlchemy. + +NOTE that FastAPI framework: + - does NOT require you to use a relational database or any database at all. + - CAN work with any ORM library (including SQLAlchemy) or database (including SQLite, which comes pre-installed in Python and is a database supported by SQLAlchemy). + - code is MINIMAL in the example below. Most of the code is standard SQLAlchemy and framework-agnostic. --- @@ -21,8 +26,8 @@ In this quickstart, we will show you how to get started with SQLite Cloud by bui mkdir sqlalchemy-quickstart cd sqlalchemy-quickstart -# open the project in VSCode -# code . +# open the project in VSCode / another editor +code . python3 -m venv .venv . .venv/bin/activate @@ -155,7 +160,8 @@ AttributeError: module 'sqlitecloud.dbapi2' has no attribute 'sqlite_version_inf 7. **References** - - If you're new to FastAPI and/or want to learn more about how to work with ORMs in FastAPI, we referenced FastAPI's [introductory example](https://fastapi.tiangolo.com/#example) and [SQL Databases tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) extensively when writing this Quickstart. - - If you're new to SQLAlchemy, refer to [their latest docs](https://docs.sqlalchemy.org/en/20/). + - [FastAPI introductory example](https://fastapi.tiangolo.com/#example) + - [FastAPI SQL Databases tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) + - [Latest SQLAlchemy docs](https://docs.sqlalchemy.org/en/20/) And that's it! You've successfully built a FastAPI app that uses SQLAlchemy ORM to read data from a SQLite Cloud database. From 790dcf975cf8a5ded0a427db5f05d5e6eb8dee26 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 9 Sep 2024 23:19:50 +0200 Subject: [PATCH 080/185] feat(python): sqlalchemy example (#93) Co-authored-by: Daniele Briggi --- sqlite-cloud/sdks/python/introduction.mdx | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/sqlite-cloud/sdks/python/introduction.mdx b/sqlite-cloud/sdks/python/introduction.mdx index 534b7fe..ac362cd 100644 --- a/sqlite-cloud/sdks/python/introduction.mdx +++ b/sqlite-cloud/sdks/python/introduction.mdx @@ -57,6 +57,7 @@ dfprices = pd.read_csv( ) ) +# Your SQLite Cloud connection string conn = sqlitecloud.connect("sqlitecloud://myhost.sqlite.cloud:8860/mydatabase.sqlite?apikey=myapikey") conn.executemany("DROP TABLE IF EXISTS ?", [("PRICES",)]) @@ -76,3 +77,61 @@ query_result = df_actual_prices.query("PRICE > 50.00") print(query_result) ``` +## Using SQLite Cloud with SQLAlchemy + +```bash +pip install sqlalchemy-sqlitecloud +``` + +```python +import sqlalchemy +from sqlalchemy import Column, ForeignKey, Integer, String +from sqlalchemy.dialects import registry +from sqlalchemy.orm import backref, declarative_base, relationship, sessionmaker + +Base = declarative_base() + + +class Artist(Base): + __tablename__ = "artists" + + ArtistId = Column("ArtistId", Integer, primary_key=True) + Name = Column("Name", String) + Albums = relationship("Album", backref=backref("artist")) + + +class Album(Base): + __tablename__ = "albums" + + AlbumId = Column("AlbumId", Integer, primary_key=True) + ArtistId = Column("ArtistId", Integer, ForeignKey("artists.ArtistId")) + Title = Column("Title", String) + +# Your SQLite Cloud connection string +connection_string = "sqlitecloud://myhost.sqlite.cloud:8860/mydatabase.sqlite?apikey=myapikey" + +engine = sqlalchemy.create_engine(connection_string) +Session = sessionmaker(bind=engine) +session = Session() + +name = "John Doe" +query = sqlalchemy.insert(Artist).values(Name=name) +result_insert = session.execute(query) + +title = "The Album" +query = sqlalchemy.insert(Album).values( + ArtistId=result_insert.lastrowid, Title=title +) +session.execute(query) + +query = ( + sqlalchemy.select(Artist, Album) + .join(Album, Artist.ArtistId == Album.ArtistId) + .where(Artist.ArtistId == result_insert.lastrowid) +) + +result = session.execute(query).fetchone() + +print("Artist Name: " + result[0].Name) +print("Album Title: " + result[1].Title) +``` \ No newline at end of file From 83d15ebef91b9df134b0591bb476ec3d06d2ad32 Mon Sep 17 00:00:00 2001 From: Caheri Aguilar <61262911+c-arriagada@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:16:24 -0500 Subject: [PATCH 081/185] updated react native quick start (#98) --- sqlite-cloud/quick-start-react-native.mdx | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 159b01f..66a2fec 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -26,10 +26,10 @@ cd sqlc-quickstart eas init --id {id} ``` -3. **Install the SQLite Cloud JS SDK** +3. **Install the SQLite Cloud JS SDK and peer dependencies** ```bash -npm install @sqlitecloud/drivers +npm install @sqlitecloud/drivers react-native-tcp-socket react-native-fast-base64 ``` 4. **Query data** @@ -46,13 +46,14 @@ export default function App() { useEffect(() => { async function getAlbums() { - const db = new Database({ - connectionstring: '', - usewebsocket: true, - }); + const db = new Database(''); const result = - await db.sql`USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`; + await db.sql`USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`; setAlbums(result); } @@ -93,13 +94,14 @@ const styles = StyleSheet.create({ 5. **Run your app** +Expo run iOS ```bash -npm start +npx expo prebuild && npx expo run:ios ``` - - To see your app: - - On iOS, use the Camera app to scan the QR code. - - On Android, download and use the Expo Go app to scan the QR code. - - On web, visit the localhost link. +Expo run Android +```bash +npx expo prebuild && npx expo run:android +``` And that's it! You've successfully built a React Native app that reads data from a SQLite Cloud database. \ No newline at end of file From eb6a0018d0e710488e58c1cd54c1cfabf733ba47 Mon Sep 17 00:00:00 2001 From: Caheri Aguilar <61262911+c-arriagada@users.noreply.github.com> Date: Mon, 23 Sep 2024 17:06:15 -0500 Subject: [PATCH 082/185] updated edge functions documentation (#99) --- sqlite-cloud/platform/edge-functions.mdx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index 080c51d..fd8e721 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -16,8 +16,8 @@ Turning on linearizable reads ensures strong consistency, but may introduce some ## Getting Started 1. Navigate to the Edge Functions page from your dashboard. -1. Under "Development", select "Edge Function", then click the "Create" button. -1. Write and test your function. +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. @@ -31,6 +31,24 @@ return { } ``` +### 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. + +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 }`). + +### 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 Use the global `connection` object to access and manipulate your database. From e7b12ee132024b12685f598d64b93e45d7abc073 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 28 Sep 2024 17:39:32 -0700 Subject: [PATCH 083/185] feat: start adding weblite example request and response --- sqlite-cloud/platform/weblite.mdx | 128 ++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/sqlite-cloud/platform/weblite.mdx b/sqlite-cloud/platform/weblite.mdx index d6f154b..d4abf37 100644 --- a/sqlite-cloud/platform/weblite.mdx +++ b/sqlite-cloud/platform/weblite.mdx @@ -19,3 +19,131 @@ From here, you'll find a list of APIs you can use to interact with your SQLite C - **Functions**: Endpoints for executing SQLite functions. - **Webhooks**: Endpoints for creating and managing webhooks. - **Files**: Endpoints for uploading and downloading files. + +## Services +Services are endpoints for health checks, server information, and more. + +### Health Check +Example request: +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/health' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: +```json +{ + "data": { + "name": "@sqlitecloud/gateway", + "version": "x.x.x", + "project": "xxxxxxxxxx", + "node": "xxxxxxxxxx", + "hostname": "xxxxxxxxxx", + "started": "YYYY-MM-DDTHH:mm:ss.sssZ", + "uptime": "XXh:XXm:XXs" + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Info +Example request: +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/info' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: +```json +{ + "data": { + "name": "@sqlitecloud/gateway", + "version": "x.x.x", + "project": "xxxxxxxxxx", + "node": "xxxxxxxxxx", + "hostname": "xxxxxxxxxx", + "started": "YYYY-MM-DDTHH:mm:ss.sssZ", + "uptime": "XXh:XXm:XXs", + "drivers": { + "name": "@sqlitecloud/drivers", + "version": "x.x.x" + }, + "runtime": { + "name": "xxxxxxx", + "version": "x.x.x", + "path": "/path/to/runtime", + "main": "/path/to/main/file" + }, + "environment": { + "events": true, + "settings": true, + "stats": true, + "logs": true + }, + "metrics": { + "js_heap_size": 00000000, + "js_heap_capacity": 00000000, + "js_heap_object_count": 000000, + "cpu_user": 00.0, + "cpu_system": 0.00, + "http_requests": 00000, + "http_get": 00000, + "http_completed": 00000, + "http_options": 00, + "ws_requests": 00, + "ws_get": 00, + "ws_completed": 00, + "http_patch": 0, + "http_post": 0 + }, + "internetAccess": true + }, + "metadata": { + "connectedMs": 00, + "executedMs": 00, + "elapsedMs": 00 + } +} +``` + +## Stats +Example request: +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/stats' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: +```json +{ + "data": { + "physicalMemory": 0000000000, + "bytesIn": 00000, + "bytesOut": 000000, + "cpuLoad": 0.00000000000000, + "currentClients": 0, + "currentMemory": 0000000, + "maxClients": 0, + "maxMemory": 0000000, + "numCommands": 000, + "numReads": 00, + "numWrites": 0 + }, + "metadata": { + "connectedMs": 00, + "executedMs": 00, + "elapsedMs": 00 + } +} +``` + From a250c0e0ac9a36c5314e9afda695ad1231188847 Mon Sep 17 00:00:00 2001 From: Caheri Date: Mon, 30 Sep 2024 16:32:22 -0500 Subject: [PATCH 084/185] added request-response examples for all weblite endpoints --- sqlite-cloud/platform/weblite.mdx | 611 +++++++++++++++++++++++++++++- 1 file changed, 606 insertions(+), 5 deletions(-) diff --git a/sqlite-cloud/platform/weblite.mdx b/sqlite-cloud/platform/weblite.mdx index d4abf37..98ae0df 100644 --- a/sqlite-cloud/platform/weblite.mdx +++ b/sqlite-cloud/platform/weblite.mdx @@ -6,25 +6,30 @@ status: publish slug: weblite --- -Weblite consists of an autogenerated HTTP/JSON REST API for programmatically interacting with SQLite Cloud. +Weblite consists of an autogenerated HTTP/JSON REST API for programmatically interacting with SQLite Cloud. It is the simplest way to add a robust database backend to your application. ## Overview + First, navigate to the Weblite panel from the left-hand navigation menu. From here, you'll find a list of APIs you can use to interact with your SQLite Cloud instance, including: + - **Services**: Endpoints for health checks, metrics, and more. -- **Weblite**: Endpoints for executing SQLiteCloudArrayType, and interacting with datbases and tables. +- **Weblite**: Endpoints for executing SQLiteCloudArrayType, and interacting with databases and tables. - **Functions**: Endpoints for executing SQLite functions. - **Webhooks**: Endpoints for creating and managing webhooks. - **Files**: Endpoints for uploading and downloading files. ## Services + Services are endpoints for health checks, server information, and more. ### Health Check + Example request: + ```bash curl -X 'GET' \ 'https://.sqlite.cloud:8090/v2/health' \ @@ -33,6 +38,7 @@ curl -X 'GET' \ ``` Example response: + ```json { "data": { @@ -52,8 +58,10 @@ Example response: } ``` -### Info +### Info + Example request: + ```bash curl -X 'GET' \ 'https://.sqlite.cloud:8090/v2/info' \ @@ -62,6 +70,7 @@ curl -X 'GET' \ ``` Example response: + ```json { "data": { @@ -114,8 +123,10 @@ Example response: } ``` -## Stats +## Stats + Example request: + ```bash curl -X 'GET' \ 'https://.sqlite.cloud:8090/v2/stats' \ @@ -124,13 +135,14 @@ curl -X 'GET' \ ``` Example response: + ```json { "data": { "physicalMemory": 0000000000, "bytesIn": 00000, "bytesOut": 000000, - "cpuLoad": 0.00000000000000, + "cpuLoad": 0.0, "currentClients": 0, "currentMemory": 0000000, "maxClients": 0, @@ -147,3 +159,592 @@ Example response: } ``` +## Weblite + +Weblite are endpoints for executing SQLiteCloudArrayType, and interacting with databases and tables. + +### Run SQL queries on the node - GET + +Example request: + +```bash +sql_query="SELECT * FROM artists LIMIT 3" + +encoded_query=$(printf '%s' "$sql_query" | jq -sRr @uri) + +curl -X 'GET' \ + "https://.sqlite.cloud:8090/v2/weblite/sql?sql=$&database=" \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": [ + { "ArtistId": 1, "Name": "AC/DC" }, + { "ArtistId": 2, "Name": "Accept" }, + { "ArtistId": 3, "Name": "Aerosmith" } + ], + "metadata": { + "connectedMs": X, + "executedMs": XX, + "elapsedMs": XX, + "database": "chinook.sqlite", + "sql": "SELECT * FROM artists LIMIT 3", + "version": X, + "numberOfRows": X, + "numberOfColumns": X, + "columns": [ + { + "name": "ArtistId", + "type": "INTEGER", + "database": "main", + "table": "artists", + "column": "ArtistId", + "notNull": 1, + "primaryKey": 1, + "autoIncrement": 1 + }, + { + "name": "Name", + "type": "NVARCHAR(120)", + "database": "main", + "table": "artists", + "column": "Name", + "notNull": 0, + "primaryKey": 0, + "autoIncrement": 0 + } + ] + } +} +``` + +### Run SQL queries on the node - POST + +Example request: + +```bash +sql="SELECT * FROM albums LIMIT 5" + +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite/sql \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + -d "{\"sql\":\"$sql\", \"database\": \"chinook.sqlite\"}" +``` + +Example response: + +```json +{ + "data": [ + { + "AlbumId": 1, + "Title": "For Those About To Rock We Salute You", + "ArtistId": 1 + }, + { "AlbumId": 2, "Title": "Balls to the Wall", "ArtistId": 2 }, + { "AlbumId": 3, "Title": "Restless and Wild", "ArtistId": 2 }, + { "AlbumId": 4, "Title": "Let There Be Rock", "ArtistId": 1 }, + { "AlbumId": 5, "Title": "Big Ones", "ArtistId": 3 } + ], + "metadata": { + "connectedMs": XX, + "executedMs": XX, + "elapsedMs": XX, + "database": "chinook.sqlite", + "sql": "SELECT * FROM albums LIMIT 5", + "version": X, + "numberOfRows": X, + "numberOfColumns": X, + "columns": [ + { + "name": "AlbumId", + "type": "INTEGER", + "database": "main", + "table": "albums", + "column": "AlbumId", + "notNull": 1, + "primaryKey": 1, + "autoIncrement": 1 + }, + { + "name": "Title", + "type": "NVARCHAR(160)", + "database": "main", + "table": "albums", + "column": "Title", + "notNull": 1, + "primaryKey": 0, + "autoIncrement": 0 + }, + { + "name": "ArtistId", + "type": "INTEGER", + "database": "main", + "table": "albums", + "column": "ArtistId", + "notNull": 1, + "primaryKey": 0, + "autoIncrement": 0 + } + ] + } +} +``` + +### List databases on the node + +Example request: + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/weblite/databases' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": [ + { + "type": "database", + "name": "chinook.sqlite", + "size": XXXXXX, + "connections": X, + "encryption": null, + "backup": X, + "nread": X, + "nwrite": X, + "inbytes": X, + "outbytes": X, + "fragmentation": "X.XX", + "pagesize": XXXX, + "encoding": "UTF-8", + "status": X + }, + ], + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### List all tables in a database + +Example request: + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/weblite//tables' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": [ + { + "type": "table", + "name": "albums" + }, + { + "type": "table", + "name": "artists" + } + ], + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### List all columns in a table + +Example request: + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/weblite///columns' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": [ + { + "cid": 0, + "name": "AlbumId", + "type": "INTEGER", + "notnull": 1, + "dflt_value": null, + "pk": 1 + }, + { + "cid": 1, + "name": "Title", + "type": "NVARCHAR(160)", + "notnull": 1, + "dflt_value": null, + "pk": 0 + }, + { + "cid": 2, + "name": "ArtistId", + "type": "INTEGER", + "notnull": 1, + "dflt_value": null, + "pk": 0 + } + ], + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Download database from the node + +Example request: + +```bash +curl -X 'GET' -o chinook.sqlite \ + 'https://.sqlite.cloud:8090/v2/weblite/' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +A binary file representing the database, eg.chinook.sqlite. + +```bash + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 866k 100 866k 0 0 1146k 0 --:--:-- --:--:-- --:--:-- 1145k +``` + +### Upload new database to the node + +Example request: + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite/' \ + -H 'Content-Type: application/octet-stream' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + --data-binary @ +``` + +Example response: + +```json +{ + "data": { + "name": "newchinook.sqlite", + "size": XXXXXX, + "connections": X, + "encryption": null, + "backup": X, + "nread": X, + "nwrite": X, + "inbytes": X, + "outbytes": X, + "fragmentation": "X.XX", + "pagesize": XXXX, + "encoding": "UTF-8", + "status": X + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Replace existing database on the node + +Example request: + +```bash +curl -X 'PATCH' \ + 'https://.sqlite.cloud:8090/v2/weblite/' \ + -H 'Content-Type: application/octet-stream' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + --data-binary @ +``` + +Example response: + +```json +{ + "data": { + "name": "chinook.sqlite", + "size": XXXXXX, + "connections": X, + "encryption": null, + "backup": X, + "nread": X, + "nwrite": X, + "inbytes": X, + "outbytes": X, + "fragmentation": "X.XX", + "pagesize": XXXX, + "encoding": "UTF-8", + "status": X + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Delete database from the node + +Example request: + +```bash +curl -X 'DELETE' \ + 'https://.sqlite.cloud:8090/v2/weblite/' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": "OK", + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Select all rows from a table + +Example request: + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/weblite//' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": [ + { + "AlbumId": 1, + "Title": "For Those About To Rock We Salute You", + "ArtistId": 1 + }, + { + "AlbumId": 2, + "Title": "Balls to the Wall", + "ArtistId": 2 + } + ], + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Insert one or more rows into a table + +Example request: + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite//' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + -d '[{"Name": "Il Divo"}, {"Name": "Natalia LaFourcade"}]' +``` + +Example response: + +`````json +{ + "data": "OK", + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} + +### Delete all rows in a table (or only those rows specified in search string parameters) + +Example request: + +```bash +curl -X 'DELETE' \ + 'https://.sqlite.cloud:8090/v2/weblite//' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +````json +{ + "data": "OK", + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} + +### Select single row by row id + +Example request: + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:8090/v2/weblite///' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +````` + +Example response: + +```json +{ + "data": { + "ArtistId": 10, + "Name": "Billy Cobham" + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Insert specific single row into a table + +Example request: + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite///' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + -d '{"Name": "Alessandro Safina"}' +``` + +Example response: + +```json +{ + "data": { + "type": XX, + "index": X, + "lastID": XXX, + "changes": 1, + "totalChanges": 1, + "finalized": 1, + "rowId": X + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Update specific row by row id + +Example request: + +```bash +curl -X 'PATCH' \ + 'https://.sqlite.cloud:8090/v2/weblite///' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + -d '{"title": "TEST"}' +``` + +Example response: + +```json +{ + "data": { + "type": XX, + "index": X, + "lastID": 276, + "changes": 1, + "totalChanges": 1, + "finalized": 1, + "rowId": X + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` + +### Delete specific row in a table + +Example request: + +```bash +curl -X 'DELETE' \ + 'https://.sqlite.cloud:8090/v2/weblite///' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +Example response: + +```json +{ + "data": { + "type": XX, + "index": X, + "lastID": X, + "changes": 1, + "totalChanges": 1, + "finalized": 1, + "rowId": X + }, + "metadata": { + "connectedMs": "XX", + "executedMs": "X", + "elapsedMs": "XX" + } +} +``` From 62c99a5ee986657209a6aafac588099170656869 Mon Sep 17 00:00:00 2001 From: Caheri Aguilar <61262911+c-arriagada@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:27:07 -0500 Subject: [PATCH 085/185] minor formatting fix for weblite (#102) --- sqlite-cloud/platform/weblite.mdx | 110 +++++++++++++++--------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/sqlite-cloud/platform/weblite.mdx b/sqlite-cloud/platform/weblite.mdx index 98ae0df..9a44fc9 100644 --- a/sqlite-cloud/platform/weblite.mdx +++ b/sqlite-cloud/platform/weblite.mdx @@ -188,14 +188,14 @@ Example response: { "ArtistId": 3, "Name": "Aerosmith" } ], "metadata": { - "connectedMs": X, - "executedMs": XX, - "elapsedMs": XX, + "connectedMs": "X", + "executedMs": "XX", + "elapsedMs": "XX", "database": "chinook.sqlite", "sql": "SELECT * FROM artists LIMIT 3", - "version": X, - "numberOfRows": X, - "numberOfColumns": X, + "version": "X", + "numberOfRows": "X", + "numberOfColumns": "X", "columns": [ { "name": "ArtistId", @@ -252,14 +252,14 @@ Example response: { "AlbumId": 5, "Title": "Big Ones", "ArtistId": 3 } ], "metadata": { - "connectedMs": XX, - "executedMs": XX, - "elapsedMs": XX, + "connectedMs": "XX", + "executedMs": "XX", + "elapsedMs": "XX", "database": "chinook.sqlite", "sql": "SELECT * FROM albums LIMIT 5", - "version": X, - "numberOfRows": X, - "numberOfColumns": X, + "version": "X", + "numberOfRows": "X", + "numberOfColumns": "X", "columns": [ { "name": "AlbumId", @@ -315,18 +315,18 @@ Example response: { "type": "database", "name": "chinook.sqlite", - "size": XXXXXX, - "connections": X, + "size": "XXXXXX", + "connections": "X", "encryption": null, - "backup": X, - "nread": X, - "nwrite": X, - "inbytes": X, - "outbytes": X, + "backup": "X", + "nread": "X", + "nwrite": "X", + "inbytes": "X", + "outbytes": "X", "fragmentation": "X.XX", - "pagesize": XXXX, + "pagesize": "XXXX", "encoding": "UTF-8", - "status": X + "status": "X" }, ], "metadata": { @@ -458,18 +458,18 @@ Example response: { "data": { "name": "newchinook.sqlite", - "size": XXXXXX, - "connections": X, + "size": "XXXXXX", + "connections": "X", "encryption": null, - "backup": X, - "nread": X, - "nwrite": X, - "inbytes": X, - "outbytes": X, + "backup": "X", + "nread": "X", + "nwrite": "X", + "inbytes": "X", + "outbytes": "X", "fragmentation": "X.XX", - "pagesize": XXXX, + "pagesize": "XXXX", "encoding": "UTF-8", - "status": X + "status": "X" }, "metadata": { "connectedMs": "XX", @@ -497,18 +497,18 @@ Example response: { "data": { "name": "chinook.sqlite", - "size": XXXXXX, - "connections": X, + "size": "XXXXXX", + "connections": "X", "encryption": null, - "backup": X, - "nread": X, - "nwrite": X, - "inbytes": X, - "outbytes": X, + "backup": "X", + "nread": "X", + "nwrite": "X", + "inbytes": "X", + "outbytes": "X", "fragmentation": "X.XX", - "pagesize": XXXX, + "pagesize": "XXXX", "encoding": "UTF-8", - "status": X + "status": "X" }, "metadata": { "connectedMs": "XX", @@ -591,7 +591,7 @@ curl -X 'POST' \ Example response: -`````json +```json { "data": "OK", "metadata": { @@ -600,6 +600,7 @@ Example response: "elapsedMs": "XX" } } +``` ### Delete all rows in a table (or only those rows specified in search string parameters) @@ -614,7 +615,7 @@ curl -X 'DELETE' \ Example response: -````json +```json { "data": "OK", "metadata": { @@ -623,6 +624,7 @@ Example response: "elapsedMs": "XX" } } +``` ### Select single row by row id @@ -633,7 +635,7 @@ curl -X 'GET' \ 'https://.sqlite.cloud:8090/v2/weblite///' \ -H 'accept: application/json' \ -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' -````` +``` Example response: @@ -668,13 +670,13 @@ Example response: ```json { "data": { - "type": XX, - "index": X, - "lastID": XXX, + "type": "XX", + "index": "X", + "lastID": "XXX", "changes": 1, "totalChanges": 1, "finalized": 1, - "rowId": X + "rowId": "X" }, "metadata": { "connectedMs": "XX", @@ -701,13 +703,13 @@ Example response: ```json { "data": { - "type": XX, - "index": X, - "lastID": 276, + "type": "XX", + "index": "X", + "lastID": "XXX", "changes": 1, "totalChanges": 1, "finalized": 1, - "rowId": X + "rowId": "X" }, "metadata": { "connectedMs": "XX", @@ -733,13 +735,13 @@ Example response: ```json { "data": { - "type": XX, - "index": X, - "lastID": X, + "type": "XX", + "index": "X", + "lastID": "X", "changes": 1, "totalChanges": 1, "finalized": 1, - "rowId": X + "rowId": "X" }, "metadata": { "connectedMs": "XX", From 8fd10d40b5c652f47e789ae888b24e080ea7bcde Mon Sep 17 00:00:00 2001 From: Sujal Gurung <86787475+dinesh-58@users.noreply.github.com> Date: Sat, 9 Nov 2024 18:24:19 +0545 Subject: [PATCH 086/185] replace broken register links --- sqlite-cloud/quick-start-apollo-graphql.mdx | 2 +- sqlite-cloud/quick-start-cdn.mdx | 2 +- sqlite-cloud/quick-start-django.mdx | 2 +- sqlite-cloud/quick-start-flask.mdx | 2 +- sqlite-cloud/quick-start-gin.mdx | 2 +- sqlite-cloud/quick-start-next.mdx | 2 +- sqlite-cloud/quick-start-node.mdx | 2 +- sqlite-cloud/quick-start-php-laravel.mdx | 2 +- sqlite-cloud/quick-start-prisma.mdx | 2 +- sqlite-cloud/quick-start-react-native.mdx | 2 +- sqlite-cloud/quick-start-react.mdx | 2 +- sqlite-cloud/quick-start-sqlalchemy-orm.mdx | 2 +- sqlite-cloud/quick-start-streamlit.mdx | 2 +- sqlite-cloud/sdks/go/introduction.mdx | 2 +- sqlite-cloud/tutorial-geopoly.mdx | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sqlite-cloud/quick-start-apollo-graphql.mdx b/sqlite-cloud/quick-start-apollo-graphql.mdx index 1fe4126..97bc674 100644 --- a/sqlite-cloud/quick-start-apollo-graphql.mdx +++ b/sqlite-cloud/quick-start-apollo-graphql.mdx @@ -9,7 +9,7 @@ slug: quick-start-apollo-graphql In this quickstart, we will show you how to get started with SQLite Cloud and Apollo/GraphQL by writing a simple GraphQL wrapper around a SQLite Cloud database connection. 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Install the necessary dependencies** diff --git a/sqlite-cloud/quick-start-cdn.mdx b/sqlite-cloud/quick-start-cdn.mdx index 57742cc..97b093b 100644 --- a/sqlite-cloud/quick-start-cdn.mdx +++ b/sqlite-cloud/quick-start-cdn.mdx @@ -11,7 +11,7 @@ In this quickstart, we demonstrate how to locally serve the SQLite Cloud JS Driv --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a JavaScript / TypeScript app** diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quick-start-django.mdx index 87b1add..1a43cae 100644 --- a/sqlite-cloud/quick-start-django.mdx +++ b/sqlite-cloud/quick-start-django.mdx @@ -9,7 +9,7 @@ slug: quick-start-django In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database. 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Django app** diff --git a/sqlite-cloud/quick-start-flask.mdx b/sqlite-cloud/quick-start-flask.mdx index bbfa5f4..392091b 100644 --- a/sqlite-cloud/quick-start-flask.mdx +++ b/sqlite-cloud/quick-start-flask.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Fl --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Flask app** diff --git a/sqlite-cloud/quick-start-gin.mdx b/sqlite-cloud/quick-start-gin.mdx index 608a0e8..58eeae6 100644 --- a/sqlite-cloud/quick-start-gin.mdx +++ b/sqlite-cloud/quick-start-gin.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Go --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new database. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new database. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Gin app** diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 267b036..173d346 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Ne --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 0c0b8a8..e8bb0d2 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and No --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Node.js app** - Navigate to your target directory and run the following command to initialize your Node.js app and install the necessary depedencies: diff --git a/sqlite-cloud/quick-start-php-laravel.mdx b/sqlite-cloud/quick-start-php-laravel.mdx index bebaa60..2442e2b 100644 --- a/sqlite-cloud/quick-start-php-laravel.mdx +++ b/sqlite-cloud/quick-start-php-laravel.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and PH --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Laravel app** diff --git a/sqlite-cloud/quick-start-prisma.mdx b/sqlite-cloud/quick-start-prisma.mdx index e8fd237..cda146a 100644 --- a/sqlite-cloud/quick-start-prisma.mdx +++ b/sqlite-cloud/quick-start-prisma.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Pr --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 66a2fec..fb142f8 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React Native project** diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index 5d46c04..022bb56 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React app** - Create a React app using a Vite template diff --git a/sqlite-cloud/quick-start-sqlalchemy-orm.mdx b/sqlite-cloud/quick-start-sqlalchemy-orm.mdx index 2490c51..736e249 100644 --- a/sqlite-cloud/quick-start-sqlalchemy-orm.mdx +++ b/sqlite-cloud/quick-start-sqlalchemy-orm.mdx @@ -16,7 +16,7 @@ NOTE that FastAPI framework: --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a new Python project** diff --git a/sqlite-cloud/quick-start-streamlit.mdx b/sqlite-cloud/quick-start-streamlit.mdx index ba3b864..7eab3cd 100644 --- a/sqlite-cloud/quick-start-streamlit.mdx +++ b/sqlite-cloud/quick-start-streamlit.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and St --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Streamlit app** diff --git a/sqlite-cloud/sdks/go/introduction.mdx b/sqlite-cloud/sdks/go/introduction.mdx index 571c7c7..0171f51 100644 --- a/sqlite-cloud/sdks/go/introduction.mdx +++ b/sqlite-cloud/sdks/go/introduction.mdx @@ -76,7 +76,7 @@ sqlitecloud://user:pass@host.com:port/dbname?timeout=10&key2=value2&key3=value3 To get a valid connection string, follow these instructions: -- Get a [SQLite Cloud](https://sqlitecloud.io/register) account. See the documentation for details. +- Get a [SQLite Cloud](https://dashboard.sqlitecloud.io/auth/sign-in) account. See the documentation for details. - Create a SQLite Cloud project - Create a SQLite Cloud database - Get the connection string by clicking on the node address in the [Dashboard Nodes](https://docs.sqlitecloud.io/docs/introduction/nodes) section. A valid connection string will be copied to your clipboard. diff --git a/sqlite-cloud/tutorial-geopoly.mdx b/sqlite-cloud/tutorial-geopoly.mdx index 9bb5d21..e26b41a 100644 --- a/sqlite-cloud/tutorial-geopoly.mdx +++ b/sqlite-cloud/tutorial-geopoly.mdx @@ -106,7 +106,7 @@ out skel qt; **3. Create a new SQLite Cloud database** - - If you haven't already, [sign up for a SQLite Cloud account](https://sqlitecloud.io/register) and create a new project. + - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - In your account dashboard's left nav, click Databases, then Create Database. Name your new database `geopoly-demo`. From b9ef0beab87cef0caa66919fd607cc80f64db7d2 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Fri, 13 Dec 2024 16:59:36 -0800 Subject: [PATCH 087/185] clean up intro --- sqlite-cloud/index.mdx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index ee4cd6d..779ac85 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -6,29 +6,29 @@ status: publish --- ## Overview -**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. +**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. It is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use SQLite Cloud from the most popular programming languages or its REST API. -It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. +--- -**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. +## Multi-node Architecture +Every SQLite Cloud project is powered by a multi-node cluster, where each node is running the official SQLite database engine. The cluster uses the [Raft](https://raft.github.io) consensus algorithm to keep your underlying database files in sync across nodes. All of this happens in the background, so you can interact with your database as if it were a single, local database. ---- +SQLite Cloud supports both strong and eventual consistency, and comes with a multi-region load balancer to ensure optimal performance. -## Architecture +## The Official SQLite +When you interact with a SQLite Cloud database, you are interacting with the official open source SQLite engine. This means SQLite Cloud supports all the same features as SQLite. It is fully ACID compliant, supports non-deterministic SQL statements, and is compatible with the SQLite extension ecosystem.\ -**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. +It also means that you can have as many or as few databases as you want - each database is a file. This means SQLite Cloud can be used for both multi-tenant applications (single-user database), and as a multi-tenant database (one database, many users). -**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. +## CloudSync and Row-level Security (in alpha) +We are currently in the process of building a local-first SQLite extension called "CloudSync". Once installed, you can use any driver you'd like - simply execute a custom SQL function passing in your cloud connection string, and any changes to your local database are automatically synchronized with the cloud and across devices. Offline-first comes "out of the box", and CRDTs are used to ensure merges are conflict-free. -In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. +CloudSync will also bring row-level security to SQLite for the first time, giving you control over what data is synced to a given user's device. -## Features -SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. -* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. +## A Complete Toolbox +SQLite Cloud also provides a comprehensive suite of tools for building realtime, local-first applications. +* **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. +* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access. * **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. * **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. -* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. From 1416ad87b2440f7796eeeaf0d293e10585abc21d Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Fri, 13 Dec 2024 17:00:15 -0800 Subject: [PATCH 088/185] update --- sqlite-cloud/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 779ac85..69e90b4 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -10,22 +10,22 @@ status: publish --- -## Multi-node Architecture +### Multi-node Architecture Every SQLite Cloud project is powered by a multi-node cluster, where each node is running the official SQLite database engine. The cluster uses the [Raft](https://raft.github.io) consensus algorithm to keep your underlying database files in sync across nodes. All of this happens in the background, so you can interact with your database as if it were a single, local database. SQLite Cloud supports both strong and eventual consistency, and comes with a multi-region load balancer to ensure optimal performance. -## The Official SQLite +### The Official SQLite When you interact with a SQLite Cloud database, you are interacting with the official open source SQLite engine. This means SQLite Cloud supports all the same features as SQLite. It is fully ACID compliant, supports non-deterministic SQL statements, and is compatible with the SQLite extension ecosystem.\ It also means that you can have as many or as few databases as you want - each database is a file. This means SQLite Cloud can be used for both multi-tenant applications (single-user database), and as a multi-tenant database (one database, many users). -## CloudSync and Row-level Security (in alpha) +### CloudSync and Row-level Security (in alpha) We are currently in the process of building a local-first SQLite extension called "CloudSync". Once installed, you can use any driver you'd like - simply execute a custom SQL function passing in your cloud connection string, and any changes to your local database are automatically synchronized with the cloud and across devices. Offline-first comes "out of the box", and CRDTs are used to ensure merges are conflict-free. CloudSync will also bring row-level security to SQLite for the first time, giving you control over what data is synced to a given user's device. -## A Complete Toolbox +### A Complete Toolbox SQLite Cloud also provides a comprehensive suite of tools for building realtime, local-first applications. * **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access. From 5668ec5716aadb63a36b1ed63fc09f685e9043d2 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Fri, 13 Dec 2024 17:00:49 -0800 Subject: [PATCH 089/185] update --- sqlite-cloud/index.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 69e90b4..63b4f61 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -8,8 +8,6 @@ status: publish ## Overview **SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. It is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use SQLite Cloud from the most popular programming languages or its REST API. ---- - ### Multi-node Architecture Every SQLite Cloud project is powered by a multi-node cluster, where each node is running the official SQLite database engine. The cluster uses the [Raft](https://raft.github.io) consensus algorithm to keep your underlying database files in sync across nodes. All of this happens in the background, so you can interact with your database as if it were a single, local database. From 6e098500c4b25657ec63420ddf1f6bc65e78dc56 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Fri, 13 Dec 2024 17:01:53 -0800 Subject: [PATCH 090/185] update --- sqlite-cloud/index.mdx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 63b4f61..07c7c95 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -5,25 +5,24 @@ category: getting-started status: publish --- -## Overview **SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. It is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use SQLite Cloud from the most popular programming languages or its REST API. -### Multi-node Architecture +## Multi-node Architecture Every SQLite Cloud project is powered by a multi-node cluster, where each node is running the official SQLite database engine. The cluster uses the [Raft](https://raft.github.io) consensus algorithm to keep your underlying database files in sync across nodes. All of this happens in the background, so you can interact with your database as if it were a single, local database. SQLite Cloud supports both strong and eventual consistency, and comes with a multi-region load balancer to ensure optimal performance. -### The Official SQLite +## The Official SQLite When you interact with a SQLite Cloud database, you are interacting with the official open source SQLite engine. This means SQLite Cloud supports all the same features as SQLite. It is fully ACID compliant, supports non-deterministic SQL statements, and is compatible with the SQLite extension ecosystem.\ It also means that you can have as many or as few databases as you want - each database is a file. This means SQLite Cloud can be used for both multi-tenant applications (single-user database), and as a multi-tenant database (one database, many users). -### CloudSync and Row-level Security (in alpha) +## CloudSync and Row-level Security (in alpha) We are currently in the process of building a local-first SQLite extension called "CloudSync". Once installed, you can use any driver you'd like - simply execute a custom SQL function passing in your cloud connection string, and any changes to your local database are automatically synchronized with the cloud and across devices. Offline-first comes "out of the box", and CRDTs are used to ensure merges are conflict-free. CloudSync will also bring row-level security to SQLite for the first time, giving you control over what data is synced to a given user's device. -### A Complete Toolbox +## A Complete Toolbox SQLite Cloud also provides a comprehensive suite of tools for building realtime, local-first applications. * **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access. From 2bfac5f94622d62d85f87589f84e804eb72e165f Mon Sep 17 00:00:00 2001 From: Caheri Aguilar <61262911+c-arriagada@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:06:05 -0600 Subject: [PATCH 091/185] Added Knex.js integration documentation (#100) * added knex integration documentation * updated knex integration doc --- sqlite-cloud/_nav.ts | 2 + sqlite-cloud/knex-integration.mdx | 154 ++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 sqlite-cloud/knex-integration.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index e455174..80d7863 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -23,6 +23,8 @@ const sidebarNav: SidebarNavStruct = [ { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, { title: "Tutorials", type: "inner", level: 0 }, { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, + { title: "Integrations", type: "inner", level: 0 }, + { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/knex-integration.mdx b/sqlite-cloud/knex-integration.mdx new file mode 100644 index 0000000..8407ed1 --- /dev/null +++ b/sqlite-cloud/knex-integration.mdx @@ -0,0 +1,154 @@ +--- +title: Knex.js Integration +description: Integrate SQLite Cloud with Knex.js, a popular SQL query builder. +category: getting-started +status: publish +slug: knex-integration +--- + +In this tutorial, we'll show you how to connect your TypeScript application to a SQLite Cloud database using the popular SQL builder, [Knex.js](https://knexjs.org/). + +--- + +**Prerequisites** + +- Node.js and npm installed on your system +- A SQLite Cloud account (you can sign up for a free account [here](https://sqlitecloud.io/register)) + +1. **How to connect** + +- Create a Knex.js instance that uses the SQLite Cloud JavaScript driver to connect to your database. + +```typescript +import 'dotenv/config' +import { knex } from 'knex' + +const Client_SQLite3 = require('knex/lib/dialects/sqlite3') + +// client will have sqlite3 dialect, but will use sqlitecloud-js driver +class Client_Libsql extends Client_SQLite3 { + _driver() { + return require('@sqlitecloud/drivers') + } +} + +// Create a Knex.js instance with the custom SQLite3 client +const db = knex({ + client: Client_Libsql as any, + connection: { + filename: process.env.DATABASE_URL as string + } +}) +``` + +2. **Basic Usage** + +In this example, we will use the sample datasets that come pre-loaded with SQLite Cloud. + +- Initialize a new Node project: + +```bash +npm init -y +``` + +- Install the required dependencies: + +```bash +npm install @sqlitecloud/drivers knex dotenv --save +``` + +- Install the necessary development dependencies: + +```bash +npm install @types/node nodemon ts-node typescript --save-dev +``` + +- Create a `.env` file in the root of your project and add your SQLite Cloud connection string: + +```bash +DATABASE_URL="sqlitecloud://{USER}:{PASSWORD}@{HOST}.sqlite.cloud:8860" +``` + +Replace `{USER}`, `{PASSWORD}`, and `{HOST}` with your actual SQLite Cloud credentials and server hostname. + +- Create a `tsconfig.json` file to configure your TypeScript compiler: + +```bash +tsc --init +``` + +- Create a new file called `example.ts` and add the following code: + +```typescript +import 'dotenv/config' +import { knex } from 'knex' + +const Client_SQLite3 = require('knex/lib/dialects/sqlite3') + +class Client_Libsql extends Client_SQLite3 { + _driver() { + return require('@sqlitecloud/drivers') + } +} + +console.assert(process.env.DATABASE_URL, 'Define DATABASE_URL environment variable') + +const db = knex({ + client: Client_Libsql as any, + connection: { + filename: process.env.DATABASE_URL as string + } +}) + +db.raw('USE DATABASE chinook.sqlite; SELECT * FROM customers') + .then(result => { + console.log(`Connected to database via knex and received ${result.length} rows`) + console.log(JSON.stringify(result, null, 2)) + db.destroy() + }) + .catch(err => { + console.error(err) + db.destroy() + }) +``` + +- Update your `package.json` file to include a script for running the example: + +```bash +{ + "scripts": { + "dev": "nodemon --exec ts-node example.ts" + } +} +``` + +- Start the development server: + +```bash +npm run dev +``` + +This will run the `example.ts` file using `ts-node` and will automatically restart the server when you make changes to your code. + +- Observe the output in the console, which should display the customer data fetched from the SQLite Cloud database. +```bash + [ + { + "CustomerId": 1, + "FirstName": "Luís", + "LastName": "Gonçalves", + "Company": "Embraer - Empresa Brasileira de Aeronáutica S.A.", + "Address": "Av. Brigadeiro Faria Lima, 2170", + "City": "São José dos Campos", + "State": "SP", + "Country": "Brazil", + "PostalCode": "12227-000", + "Phone": "+55 (12) 3923-5555", + "Fax": "+55 (12) 3923-5566", + "Email": "luisg@embraer.com.br", + "SupportRepId": 3 + }, + ] +``` + +And that's it! You've successfully connected your TypeScript application to a SQLite Cloud database using Knex.js. From a59ed8656c111a21cad8477437dfbb61c39bf439 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 14 Dec 2024 13:53:36 -0800 Subject: [PATCH 092/185] finish introduction section --- sqlite-cloud/index.mdx | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 07c7c95..5e57142 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -5,22 +5,45 @@ category: getting-started status: publish --- -**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. It is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use SQLite Cloud from the most popular programming languages or its REST API. +**SQLite Cloud** is a managed, distributed relational database system built on top of the [SQLite](https://www.sqlite.org/) database engine. It is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use SQLite Cloud from the most popular programming languages or its REST API. -## Multi-node Architecture -Every SQLite Cloud project is powered by a multi-node cluster, where each node is running the official SQLite database engine. The cluster uses the [Raft](https://raft.github.io) consensus algorithm to keep your underlying database files in sync across nodes. All of this happens in the background, so you can interact with your database as if it were a single, local database. +## Architecture +SQLite is a lightweight, serverless database engine designed for single-user applications. Its databases are self-contained in single files, making them ideal for embedded systems and local applications. + +SQLite Cloud brings multi-user, multi-device, and global distribution capabilities to SQLite by running SQLite in a multi-node cluster environment. Each node runs the official SQLite database engine. The databases (files) in the cluster stay synchronized through the [Raft](https://raft.github.io) consensus algorithm - an industry-standard protocol that ensures all nodes maintain consistent copies of your data.. Synchronization happens automatically and in the background. + +SQLite Cloud exposes identical APIs to SQLite, so you can interact with your cloud database files like you would if they were stored on your local file system. SQLite Cloud supports both strong and eventual consistency, and comes with a multi-region load balancer to ensure optimal performance. -## The Official SQLite -When you interact with a SQLite Cloud database, you are interacting with the official open source SQLite engine. This means SQLite Cloud supports all the same features as SQLite. It is fully ACID compliant, supports non-deterministic SQL statements, and is compatible with the SQLite extension ecosystem.\ +### The Official SQLite +SQLite Cloud is built on the open source SQLite engine, ensuring complete feature parity. You get all of SQLite's core strengths: ACID compliance, support for complex SQL operations, and compatibility with the rich SQLite extension ecosystem. + +Like SQLite, each database in SQLite Cloud is a separate file, giving you flexible deployment options: + +* Create separate databases for each customer in a multi-tenant application +* Share a single database among multiple users with built-in access controls +* Mix both approaches based on your application's needs + + +## CloudSync: Enabling Local-First Applications (Alpha Preview) + +We're developing CloudSync, a powerful SQLite extension that brings local-first capabilities to your applications. This feature is currently in alpha testing with select partners. + +Here's how it works: + +1. Create a connection to a local SQLite database using any language and driver you'd like. +2. Install the CloudSync extension. +3. Execute a special SQL function to initialize tracking of specific tables. +4. Execute another SQL function, passing in your cloud connection string to establish a relationship between your local database file and your cloud database file. +4. Define row-level security rules to control what data is synced to a given user's device. +5. Run a read query to sync your local database with the cloud. -It also means that you can have as many or as few databases as you want - each database is a file. This means SQLite Cloud can be used for both multi-tenant applications (single-user database), and as a multi-tenant database (one database, many users). +Then, whenever you write to your local database, changes are automatically synchronized with the cloud, and distributed to any other devices that have access to the changed rows. -## CloudSync and Row-level Security (in alpha) -We are currently in the process of building a local-first SQLite extension called "CloudSync". Once installed, you can use any driver you'd like - simply execute a custom SQL function passing in your cloud connection string, and any changes to your local database are automatically synchronized with the cloud and across devices. Offline-first comes "out of the box", and CRDTs are used to ensure merges are conflict-free. +No network connection? No problem. Changes from multiple users or devices are synced conflict-free when the network connection is restored thanks to [CRDTs](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type). -CloudSync will also bring row-level security to SQLite for the first time, giving you control over what data is synced to a given user's device. +We are excited to bring this extension to the SQLite community, and are actively looking for private beta testers. Please [contact us](https://sqlitecloud.io/support) if you'd like to learn more. ## A Complete Toolbox SQLite Cloud also provides a comprehensive suite of tools for building realtime, local-first applications. From b15c8fb33660f3022a33ee6af89eb148dfce169c Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 14 Dec 2024 14:03:47 -0800 Subject: [PATCH 093/185] update fundamentals and edge functions --- sqlite-cloud/connect-cluster.mdx | 5 +---- sqlite-cloud/create-database.mdx | 21 +++++++++++++++++---- sqlite-cloud/platform/edge-functions.mdx | 2 +- sqlite-cloud/write-data.mdx | 21 +++------------------ 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 8a75622..03c2c37 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -8,10 +8,7 @@ slug: connect-cluster SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each cluster comes with a multi-region load balancer that routes traffic to the nearest appropriate node. -For this reason, we strongly recommend connecting to your cluster via your project connection string. To retrieve your project connection string, navigate to the **Nodes** page and click on any node. -{/* ![Project connection string modal](@docs-website-assets/connect-cluster-1.png) */} - -Copy the connection string and use it with a client library to connect to your cluster. +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: diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index d2d7167..33a56b1 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -6,7 +6,7 @@ status: publish slug: create-database --- -SQLite Cloud allows you to import existing SQLite Databases, or create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries. +You can import an existing SQLite databases, or create new databases using the SQLite Cloud UI, API, or client libraries. ## Importing an existing SQLite database SQLite Cloud allows you to import existing SQLite databases into the platform. @@ -27,7 +27,7 @@ To create a new database from the SQLite Cloud UI, navigate to the Databases tab The default encoding is set to UTF-8, and the default page size is 4096KB. ### From the API -To create a new database or upload an existing database via [Weblite](#), our REST API, you can make a request with the following parameters: +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: ```bash curl -X 'POST' \ 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ @@ -37,11 +37,15 @@ curl -X 'POST' \ ``` ### From client libraries -To create a new database from a client library, use the CREATE DATABASE command. +To create a new database from a client library, connect to your cluster using a connection string without a specified database. + +Then, use the CREATE DATABASE command to create a new database. + +To start using the database within the connection, you can use the `USE DATABASE` command. ```javascript import { Database } from '@sqlitecloud/drivers'; - +// note that no database name is specified in the connection string path const db = new Database('sqlitecloud://.sqlite.cloud:?apikey=') const createDatabase = async () => await db.sql`CREATE DATABASE ;`; @@ -49,5 +53,14 @@ const createDatabase = async () => await db.sql`CREATE DATABASE ; createDatabase().then((res) => console.log(res)); // "OK" + +db.exec('USE DATABASE ;') + +// now you can use the database +const fetchAlbums = async () => await db.exec`SELECT * FROM albums;`; + +fetchAlbums().then((albums) => console.log(albums)); + +// [{ Title: 'For Those About To Rock We Salute You', ... }, ...] ``` diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index fd8e721..5f2def1 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -6,7 +6,7 @@ status: publish slug: edge-functions --- -Edge Functions are server-side functions that run directly within your database environment. Edge functions in SQLite Cloud ensure maximum performance and minimal latency by running functions on the same server as your database. +Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance. You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported. diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 32bd329..94a1ced 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -6,22 +6,7 @@ status: publish slug: write-data --- -After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. - -## Upload an existing SQLite Database -You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API. - -To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=.sqlite.cloud:?apikey=') db.exec('USE DATABASE mydatabase.sqlite;') -db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image BLOB);') +db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image_url text);') db.commit() const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_name, sc_year, image) VALUES ('Ferrari', 2021, 'https://example.com/ferrari.jpg');`; From 3ad1687b3409059a5c74e9b4fbd532f4d99d132a Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 14 Dec 2024 14:07:55 -0800 Subject: [PATCH 094/185] update webhooks --- sqlite-cloud/platform/webhooks.mdx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index e306a7d..f805bd3 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -6,14 +6,10 @@ status: publish slug: webhooks --- -Utilize the Webhooks panel to effortlessly establish real-time notifications for write operations within your SQLite database. In this instance, we'll seamlessly notify a webhook.site service each time a write operation occurs within the albums table of the chinook.sqlite database. +Webhooks in SQLite Cloud are a powerful way to receive and send event-based notifications. -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create.png) +## Change Data Capture +With change data webhooks, you can send notifications from SQLite Cloud to any HTTP endpoint when an insert, update or delete operation occurs on a specified database and/or table. The webhook payload includes the database name, table name, and the row data that was changed. -Upon creation, you'll receive a secret value that ensures the authenticity of each notification request. - -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create2.png) - -Additionally, access a comprehensive list of all enabled webhooks for your project. - -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_list.png) \ No newline at end of file +## Trigger Edge Functions +Webhooks can also be used to trigger your edge functions, either via HTTP or Websockets request, or on a database event. \ No newline at end of file From 5ca759a63f7973731ba1d9acfbe54912409f2f43 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 14 Dec 2024 14:11:04 -0800 Subject: [PATCH 095/185] clean up --- sqlite-cloud/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index 5e57142..e39b277 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -12,7 +12,7 @@ SQLite is a lightweight, serverless database engine designed for single-user app SQLite Cloud brings multi-user, multi-device, and global distribution capabilities to SQLite by running SQLite in a multi-node cluster environment. Each node runs the official SQLite database engine. The databases (files) in the cluster stay synchronized through the [Raft](https://raft.github.io) consensus algorithm - an industry-standard protocol that ensures all nodes maintain consistent copies of your data.. Synchronization happens automatically and in the background. -SQLite Cloud exposes identical APIs to SQLite, so you can interact with your cloud database files like you would if they were stored on your local file system. +SQLite Cloud exposes identical APIs to SQLite, so you can interact with your cloud databases like you would if they were stored on your local file system. SQLite Cloud supports both strong and eventual consistency, and comes with a multi-region load balancer to ensure optimal performance. @@ -50,5 +50,5 @@ SQLite Cloud also provides a comprehensive suite of tools for building realtime, * **[Webhooks](/docs/webhooks)**: Trigger edge functions or send change payloads via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. * **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same nodes that store your data for lightning-fast data access. * **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with the SQLite Cloud platform. * **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. From 8fab76fb3ca1815ab26767c9a9f7d34ee330e157 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Sat, 14 Dec 2024 14:13:56 -0800 Subject: [PATCH 096/185] remove settings page --- sqlite-cloud/_nav.ts | 1 - sqlite-cloud/platform/settings.mdx | 11 ----------- 2 files changed, 12 deletions(-) delete mode 100644 sqlite-cloud/platform/settings.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index e455174..182f78d 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -37,7 +37,6 @@ const sidebarNav: SidebarNavStruct = [ { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, // { title: "Storage", type: "inner", level: 0 }, // { title: "Partitioning", type: "inner", level: 0 }, - { title: "Settings", filePath: "settings", type: "inner", level: 0 }, { title: "SDKs", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/settings.mdx b/sqlite-cloud/platform/settings.mdx deleted file mode 100644 index 3e1cc46..0000000 --- a/sqlite-cloud/platform/settings.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Settings -description: The Settings panel displays a list of all the settings currently applied to your cluster. -category: platform -status: publish -slug: settings ---- - -The Settings panel displays a list of all the settings currently applied to your cluster. You have the option to modify each setting individually or reset them to their default values. - -![Dashboard Settings](@docs-website-assets/introduction/dashboard_settings.png) \ No newline at end of file From 88a6fbe93b7dfba62b3b556e5b6228f5ab0e6eae Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Thu, 2 Jan 2025 10:49:05 -0600 Subject: [PATCH 097/185] add more details for next js doc (#107) --- sqlite-cloud/quick-start-next.mdx | 155 ++++++++++++++++++++++++------ 1 file changed, 126 insertions(+), 29 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 173d346..2bf623e 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -22,54 +22,151 @@ npx create-next-app@latest sqlc-quickstart --js --no-tailwind --eslint --app --s ```bash cd sqlc-quickstart && npm install @sqlitecloud/drivers ``` -4. **Query data** - - Replace the code in ```layout.js``` and ```page.js``` with the following snippets. - - Click a node in your account dashboard and copy the connection string. Replace `````` in ```page.js``` with your connection string. +4. **Instantiate a connection** + - The Database driver establishes a TLS connection when used in Node.js, and a websocket connection when used in the browser. + - It is recommended that you use the Database driver in client-side components. + - To share the connection across pages, you can instantiate the connection in a context provider with the ```use client``` directive. Below is a simplified sample implementation. -In ```src/app/layout.js```: -```jsx -export const metadata = { - title: 'Create Next App', - description: 'Generated by create next app', -}; +```tsx +// src/app/context/DatabaseContext.tsx +'use client'; + +import { Database } from '@sqlitecloud/drivers'; +import { createContext, useContext, useEffect, useRef, useState } from 'react'; + +interface DatabaseContextType { + db: Database | null; + isConnecting: boolean; + error: Error | null; +} + +const DatabaseContext = createContext(undefined); + +interface DatabaseProviderProps { + children: React.ReactNode; + config: { connectionString: string } +} + +export function DatabaseProvider({ children, config }: DatabaseProviderProps) { + const [isConnecting, setIsConnecting] = useState(true); + const [error, setError] = useState(null); + const dbRef = useRef(null); + + useEffect(() => { + if (dbRef.current) return; // Connection already exists + + try { + dbRef.current = new Database(config.connectionString); + + // Handle connection events + dbRef.current.on('open', () => { + console.log('open') + setIsConnecting(false); + setError(null); + }); + + dbRef.current.on('error', (err: Error) => { + console.log('error') + setError(err); + setIsConnecting(false); + }); + + dbRef.current.on('close', () => { + console.log('closing') + setIsConnecting(false); + dbRef.current = null; + }); + + } catch (err) { + setError(err instanceof Error ? err : new Error('Failed to initialize database')); + setIsConnecting(false); + } + // Cleanup function + return () => { + if (dbRef.current) { + dbRef.current.close(); + dbRef.current = null; + } + }; + }, [config]); + + return ( + + {children} + + ); +} + +export function useDatabaseConnection() { + const context = useContext(DatabaseContext); + + if (context === undefined) { + throw new Error('useDatabaseConnection must be used within a DatabaseProvider'); + } + + return context; +} +``` +5. **Query data** + - Click the ```Connect``` button in your account dashboard and copy the connection string. Replace `````` in ```page.js``` with your connection string. + - Replace the code in ```layout.js``` and ```page.js``` with the following snippets. + +```jsx +// src/app/layout.js export default function RootLayout({ children }) { return ( - {children} + + ' }}> + {children} + + ); } ``` -In ```src/app/page.js```: ```jsx -import { Database } from '@sqlitecloud/drivers'; - -async function getAlbums() { - const db = new Database(''); +// src/app/page.js +import { useDatabaseConnection } from './context/DatabaseContext'; +import { useEffect, useState } from "react"; +import { useDatabaseConnection } from "./useDatabaseConnection"; - const result = await db.sql`USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; +export default function Home() { + const { db } = useDatabaseConnection(); + const [albums, setAlbums] = useState([]); - return result; -} + useEffect(() => { + const getAlbums = async () => { + const result = await db.sql`USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`; + return result; + }; -export default async function Home() { - const res = await getAlbums(); + if (db) { + getAlbums().then((result) => { + setAlbums(result); + }); + } + }, [db]); return (

    Albums

      - {res.map(({ id, title, artist }) => ( -
    • - {title} by {artist} -
    • + {albums.map((album) => ( +
      {album.title}
      ))}
    From 7cb1913d3336a3ecab3c72242891ed784fbc237e Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 09:34:19 -0800 Subject: [PATCH 098/185] flip intro with getting started --- sqlite-cloud/_nav.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 80d7863..b6ddd7f 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -2,8 +2,8 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, - { title: "Getting Started", type: "secondary", icon: "docs-star" }, - { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, // should be index page for /docs and highlight "introduction" in nav + { title: "Introduction", type: "secondary", icon: "docs-star" }, + { title: "Getting Started", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, { title: "Fundamentals", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, From f8f654cec29c668209194b845f29aae5cbf13be7 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 09:45:33 -0800 Subject: [PATCH 099/185] add architecture doc, refine getting started landing page --- draft--architecture.mdx | 8 ++++++++ sqlite-cloud/index.mdx | 32 +++++++++++--------------------- 2 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 draft--architecture.mdx diff --git a/draft--architecture.mdx b/draft--architecture.mdx new file mode 100644 index 0000000..14f692e --- /dev/null +++ b/draft--architecture.mdx @@ -0,0 +1,8 @@ + + +## Architecture +SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. + +SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows. + +SQLite Cloud supports all the SQLite features without any limitations, including ACID compliance and non-deterministic SQL statements. diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/index.mdx index ee4cd6d..4448331 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/index.mdx @@ -1,5 +1,5 @@ --- -title: Introduction to SQLite Cloud +title: Getting Started with SQLite Cloud description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. category: getting-started status: publish @@ -8,27 +8,17 @@ status: publish ## Overview **SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. -It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. +It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on SQLite Cloud to handle the complexities of managing your databases. -**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. +You can access SQLite Cloud from the most popular programming languages or its REST API. ---- - -## Architecture - -**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. - -**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. - -In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. - -## Features -SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. -* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. +### Features +SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first, edge AI applications. +* **Local Sync**: Read and write to your local SQLite database, then synchronize with the cloud and across devices in the background. (**alpha**) +* **Offline-first**: Automatically resolve conflicts between devices and the cloud with CRDTs. (**alpha**) +* **[Webhooks](/docs/webhooks)**: Send changes in your database to an external webhook or use to trigger actions. +* **[Edge Functions](/docs/edge-functions)**: Run serverless functions next to your database. Trigger via HTTP endpoint or on database operations (INSERT, UPDATE, DELETE). * **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. +* **[Weblite](/docs/weblite)**: Autogenerated REST APIs to interact with your database and edge functions. * **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. -* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. +* **Multi-region Load Balancer**: Connect from anywhere and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. From d35bf9ac20b898ed0961c709ed27cfd7ddd60528 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 09:56:01 -0800 Subject: [PATCH 100/185] clean up initial flow --- sqlite-cloud/_nav.ts | 1 - sqlite-cloud/connect-cluster.mdx | 4 ++-- sqlite-cloud/create-database.mdx | 20 +++++++++++++++++--- sqlite-cloud/write-data.mdx | 27 ++++++--------------------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index b6ddd7f..31e03ca 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -4,7 +4,6 @@ const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, { title: "Introduction", type: "secondary", icon: "docs-star" }, { title: "Getting Started", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, - { title: "Fundamentals", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 8a75622..32014ce 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -8,8 +8,7 @@ slug: connect-cluster SQLite databases in SQLite Cloud are distributed across a cluster of nodes. Each cluster comes with a multi-region load balancer that routes traffic to the nearest appropriate node. -For this reason, we strongly recommend connecting to your cluster via your project connection string. To retrieve your project connection string, navigate to the **Nodes** page and click on any node. -{/* ![Project connection string modal](@docs-website-assets/connect-cluster-1.png) */} +To retrieve your project connection string, click the "Connect" button at the bottom of the left sidebar navigation. Copy the connection string and use it with a client library to connect to your cluster. @@ -63,4 +62,5 @@ conn.close() ``` ## Next Steps +- [Creating a database](/docs/create-database) - [Writing data](/docs/write-data) diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index d2d7167..e3e17d7 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -8,11 +8,23 @@ slug: create-database SQLite Cloud allows you to import existing SQLite Databases, or create a new database in SQLite Cloud by importing an existing SQLite database, or using the SQLite Cloud UI, API, or client libraries. -## Importing an existing SQLite database -SQLite Cloud allows you to import existing SQLite databases into the platform. +## 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. -Note that you can download, modify, and re-upload the database file at any time. You can also upload encrypted SQLite databases if you used the official SEE SQLite encryption extension. +To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '' +``` + +To upload a local SQLite database via the SQLite Cloud UI, navigate to the Database tab in the left-hand navigation. Click the "Upload Database" button and select your local SQLite database. + +### 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) @@ -51,3 +63,5 @@ createDatabase().then((res) => console.log(res)); // "OK" ``` +## Next Steps +- [Writing data](/docs/write-data) diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 32bd329..d31053f 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -8,21 +8,6 @@ slug: write-data After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. -## Upload an existing SQLite Database -You can upload an existing SQLite database to your cluster using the SQLite Cloud UI or the Weblite API. - -To upload a local SQLite database via weblite, make a POST request to the `/v2/weblite/.sqlite` endpoint. - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud:8090/v2/weblite/.sqlite' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=.sqlite; -- Create your table -CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image BLOB); +CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_year INTEGER NOT NULL); -- Insert data into your table -INSERT INTO sports_cars (sc_name, sc_year, image) VALUES ('Ferrari', 2021, 'https://example.com/ferrari.jpg'); +INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021); ``` ## Writing data with the Weblite API @@ -56,10 +41,10 @@ To write data to your cluster using a client library, use the INSERT INTO SQL co import { Database } from '@sqlitecloud/drivers'; const db = new Database('sqlitecloud://.sqlite.cloud:?apikey=') -db.exec('USE DATABASE mydatabase.sqlite;') -db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_name TEXT NOT NULL, sc_year INTEGER NOT NULL, image BLOB);') +db.exec('USE DATABASE .sqlite;') +db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_year INTEGER NOT NULL);') db.commit() -const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_name, sc_year, image) VALUES ('Ferrari', 2021, 'https://example.com/ferrari.jpg');`; +const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021);`; insertData().then((res) => console.log(res)); // "OK" From 96415feb130b0894e7048ce47246bb349a57f059 Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 09:57:12 -0800 Subject: [PATCH 101/185] remove scaling section --- .../platform/scaling.mdx => _architecture.mdx | 16 +++++++++------- draft--architecture.mdx | 8 -------- 2 files changed, 9 insertions(+), 15 deletions(-) rename sqlite-cloud/platform/scaling.mdx => _architecture.mdx (75%) delete mode 100644 draft--architecture.mdx diff --git a/sqlite-cloud/platform/scaling.mdx b/_architecture.mdx similarity index 75% rename from sqlite-cloud/platform/scaling.mdx rename to _architecture.mdx index 122a8a3..608f746 100644 --- a/sqlite-cloud/platform/scaling.mdx +++ b/_architecture.mdx @@ -1,11 +1,13 @@ ---- -title: Scaling -description: How to scale your SQLite Cloud cluster. -category: platform -status: publish -slug: scaling ---- + +## Architecture +SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. + +SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows. + +SQLite Cloud supports all the SQLite features without any limitations, including ACID compliance and non-deterministic SQL statements. + +## Scaling your cluster SQLite Cloud leverages a customized Raft algorithm to maintain a robust and highly available database cluster. Here’s an essential guide on the node types within SQLite Cloud and strategic tips for scaling your cluster effectively. ## Overview of Node types diff --git a/draft--architecture.mdx b/draft--architecture.mdx deleted file mode 100644 index 14f692e..0000000 --- a/draft--architecture.mdx +++ /dev/null @@ -1,8 +0,0 @@ - - -## Architecture -SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. - -SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows. - -SQLite Cloud supports all the SQLite features without any limitations, including ACID compliance and non-deterministic SQL statements. From 742b8808f01f61effa0199e8f029d162e1058a2c Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 09:58:38 -0800 Subject: [PATCH 102/185] udpate backups intro --- sqlite-cloud/platform/backups.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/backups.mdx b/sqlite-cloud/platform/backups.mdx index b726ff8..969d7e1 100644 --- a/sqlite-cloud/platform/backups.mdx +++ b/sqlite-cloud/platform/backups.mdx @@ -7,7 +7,7 @@ slug: backups --- ## Overview -Backups provide a robust solution for mitigating data loss and resolving data corruption issues. +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. SQLite Cloud creates a full snapshot backup of your data once a day, and stores incremental changes once per second, on commodity object storage. From f54d8f1c497745bf8a0badfdeb2c640a7d32605d Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 10:05:45 -0800 Subject: [PATCH 103/185] update --- sqlite-cloud/_nav.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 4045dad..606b528 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -2,8 +2,8 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, - { title: "Introduction", type: "secondary", icon: "docs-star" }, - { title: "Getting Started", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Getting Started", type: "secondary", icon: "docs-star" }, + { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, From 37c14e8753e872bcf9e232862a62aa6c05e95f3b Mon Sep 17 00:00:00 2001 From: Jacob Prall Date: Mon, 3 Feb 2025 10:06:40 -0800 Subject: [PATCH 104/185] update sidebar --- sqlite-cloud/_nav.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 606b528..4045dad 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -2,8 +2,8 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, - { title: "Getting Started", type: "secondary", icon: "docs-star" }, - { title: "Introduction", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Introduction", type: "secondary", icon: "docs-star" }, + { title: "Getting Started", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, From c6572bdc93968961c3f32a58b4ba6b0da5a41801 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 09:03:33 +0100 Subject: [PATCH 105/185] added Overview page --- sqlite-cloud/_nav.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 4b58d75..757470f 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -3,7 +3,8 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, { title: "Introduction", type: "secondary", icon: "docs-star" }, - { title: "Getting Started", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Getting Started", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, From 04e40af385bd87f225e0b391b96d7f5d805dc345 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 09:40:00 +0100 Subject: [PATCH 106/185] removed flipath added by a merge error --- sqlite-cloud/_nav.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 757470f..f7a8652 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -26,7 +26,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Integrations", type: "inner", level: 0 }, { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, - { title: "Platform", filePath:"platform", type: "secondary", icon: "docs-plat" }, + { title: "Platform", type: "secondary", icon: "docs-plat" }, { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, @@ -40,7 +40,7 @@ const sidebarNav: SidebarNavStruct = [ // { title: "Storage", type: "inner", level: 0 }, // { title: "Partitioning", type: "inner", level: 0 }, - { title: "SDKs", filePath:"sdks", type: "secondary", icon: "docs-sdk" }, + { title: "SDKs", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, { title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, }, { title: 'Basic APIs', type: "inner", level: 1 }, @@ -176,7 +176,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Swift", type: "inner", level: 0 }, { title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 }, - { title: "Reference", filePath:"reference", type: "secondary", icon: "docs-ref" }, + { title: "Reference", type: "secondary", icon: "docs-ref" }, { title: "Server-side Commands", type: "inner", level: 0 }, { title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 }, { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, From 4341d99589f1767e3f9c1c363893a830088e4006 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 09:42:59 +0100 Subject: [PATCH 107/185] used correct syntax --- sqlite-cloud/write-data.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 01a7c62..264d55e 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -44,7 +44,7 @@ const db = new Database('sqlitecloud://.sqlite.cloud:.sqlite;') db.exec('CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_year INTEGER NOT NULL);') db.commit() -const insertData = async () => await db.sql`INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021);`; +const insertData = async () => await db.sql('INSERT INTO sports_cars (sc_make, sc_year) VALUES (?, ?)', 'Ferrari', 2021); insertData().then((res) => console.log(res)); // "OK" From 2f0171fb3006b8ff37b49fe9ba518a02b18bacd1 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 10:15:54 +0100 Subject: [PATCH 108/185] renamed index pages with cards to avoid building errors --- sqlite-cloud/_wip-index-with-card.mdx | 35 +++++++++++++++++++ .../{index.mdx => _wip-index-with-card.mdx} | 0 .../{index.mdx => _wip-index-with-card.mdx} | 0 .../{index.mdx => _wip-index-with-card.mdx} | 0 4 files changed, 35 insertions(+) create mode 100644 sqlite-cloud/_wip-index-with-card.mdx rename sqlite-cloud/platform/{index.mdx => _wip-index-with-card.mdx} (100%) rename sqlite-cloud/reference/{index.mdx => _wip-index-with-card.mdx} (100%) rename sqlite-cloud/sdks/{index.mdx => _wip-index-with-card.mdx} (100%) diff --git a/sqlite-cloud/_wip-index-with-card.mdx b/sqlite-cloud/_wip-index-with-card.mdx new file mode 100644 index 0000000..36642ea --- /dev/null +++ b/sqlite-cloud/_wip-index-with-card.mdx @@ -0,0 +1,35 @@ +--- +title: Getting Started +description: Index page for getting started section +category: getting-started +status: publish +icon: docs-star +slug: getting-started +--- +import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + +export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + +export const sections = [ + { + icon: "curvedArrow", + title: "Introduction", + description: "SQLite Cloud introduction and getting started guide.", + href: "/docs/introduction", + }, + { + icon: "twoColsGrid", + title: "Fundamentals", + description: "Learn how to connect to a cluster and start using SQLite Cloud.", + href: "/docs/connect-cluster", + }, + { + icon: "puzzle", + title: "Quick start guide", + description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + href: "/docs/quick-start-cdn", + } +] + + + \ No newline at end of file diff --git a/sqlite-cloud/platform/index.mdx b/sqlite-cloud/platform/_wip-index-with-card.mdx similarity index 100% rename from sqlite-cloud/platform/index.mdx rename to sqlite-cloud/platform/_wip-index-with-card.mdx diff --git a/sqlite-cloud/reference/index.mdx b/sqlite-cloud/reference/_wip-index-with-card.mdx similarity index 100% rename from sqlite-cloud/reference/index.mdx rename to sqlite-cloud/reference/_wip-index-with-card.mdx diff --git a/sqlite-cloud/sdks/index.mdx b/sqlite-cloud/sdks/_wip-index-with-card.mdx similarity index 100% rename from sqlite-cloud/sdks/index.mdx rename to sqlite-cloud/sdks/_wip-index-with-card.mdx From 43a2c3014b87aff05fab1b53e01f2468947cc338 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 12:35:25 +0100 Subject: [PATCH 109/185] trigger build --- sqlite-cloud/platform/_wip-index-with-card.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlite-cloud/platform/_wip-index-with-card.mdx b/sqlite-cloud/platform/_wip-index-with-card.mdx index ec07706..875df1e 100644 --- a/sqlite-cloud/platform/_wip-index-with-card.mdx +++ b/sqlite-cloud/platform/_wip-index-with-card.mdx @@ -8,6 +8,7 @@ slug: platform --- import IndexPage from "@docs-website-components/Docs/IndexPage.astro" + export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." export const sections = [ From 10bf6ddcf23271889dc5112c4fceecc3250cca92 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 12:53:31 +0100 Subject: [PATCH 110/185] added frontmatter part --- _architecture.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_architecture.mdx b/_architecture.mdx index 608f746..6f37729 100644 --- a/_architecture.mdx +++ b/_architecture.mdx @@ -1,4 +1,10 @@ - +--- +title: Architecture +description: SQLite Cloud Architecture +category: getting-started +status: draft +slug: architecture +--- ## Architecture SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. From 83dac558f50e73d423c4d441c74583f473e9ec33 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 13:14:35 +0100 Subject: [PATCH 111/185] triggering build --- _architecture.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/_architecture.mdx b/_architecture.mdx index 6f37729..542fa94 100644 --- a/_architecture.mdx +++ b/_architecture.mdx @@ -6,6 +6,7 @@ status: draft slug: architecture --- + ## Architecture SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. From cc8684c64230d52285a0a3a565690056a6547ba6 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 13:57:47 +0100 Subject: [PATCH 112/185] fixed file name and slug --- sqlite-cloud/_nav.ts | 813 +++++++++++++++++------ sqlite-cloud/introduction.mdx | 35 - sqlite-cloud/{index.mdx => overview.mdx} | 1 + 3 files changed, 615 insertions(+), 234 deletions(-) delete mode 100644 sqlite-cloud/introduction.mdx rename sqlite-cloud/{index.mdx => overview.mdx} (99%) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index f7a8652..12a6683 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -1,205 +1,620 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ - { title: "", type: "primary" }, - { title: "Introduction", type: "secondary", icon: "docs-star" }, - { title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, - { title: "Getting Started", type: "inner", level: 0 }, - { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, - { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, - { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, - { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, - { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, - { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, - { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, - { title: "Tutorials", type: "inner", level: 0 }, - { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, - { title: "Integrations", type: "inner", level: 0 }, - { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, - - { title: "Platform", type: "secondary", icon: "docs-plat" }, - { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, - { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, - { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, - { title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, - { title: "Security and Access Control", filePath: "security", type: "inner", level: 0 }, - { title: "Backups", filePath: "backups", type: "inner", level: 0 }, - { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, - { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, - { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, - // { title: "Storage", type: "inner", level: 0 }, - // { title: "Partitioning", type: "inner", level: 0 }, - - { title: "SDKs", type: "secondary", icon: "docs-sdk" }, - { title: "C/C++", type: "inner", level: 0 }, - { title: "Introduction", type: "inner", filePath: "sdk-c-introduction", level: 1, }, - { title: 'Basic APIs', type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConnect', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConnectWithString', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudExec', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudExecArray', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudUUID', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudDisconnect', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudConfig', type: "inner", level: 2 }, - - { title: 'Result APIs', type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultIsOK', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultIsError', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultLen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultInt32', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultInt64', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultFloat', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultDouble', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultFree', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudResultDump', type: "inner", level: 2 }, - - { title: "Rowset APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValueType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetColumnName', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt32Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetInt64Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetFloatValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudRowsetDump', type: "inner", level: 2 }, - - - { title: "Array APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayValueType', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayCount', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayInt32Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayInt64Value', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayFloatValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayDoubleValue', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudArrayDump', type: "inner", level: 2 }, - - { title: "Error APIs", type: "inner", level: 1 }, - { title: 'SQCloudIsError', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudIsSQLiteError', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorCode', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudExtendedErrorCode', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorOffset', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - { title: 'SQCloudErrorMsg', filePath: 'sqlite-cloud/sdks/c/SQCloudError', type: "inner", level: 2 }, - - { title: "VM APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMCompile', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMStep', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMResult', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMClose', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMErrorMsg', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMErrorCode', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsReadOnly', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsExplain', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMIsFinalized', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterCount', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMBindParameterName', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumnCount', type: "inner", level: 2 }, - { title: 'SQCloudVMBindDouble', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindInt', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindInt64', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindNull', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindText', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMBindZeroBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMBind', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnBlob', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnText', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnDouble', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnInt32', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnInt64', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnLen', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { title: 'SQCloudVMColumnType', filePath: 'sqlite-cloud/sdks/c/SQCloudVMColumn', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMLastRowID', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMChanges', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudVMTotalChanges', type: "inner", level: 2 }, - { title: "Blob APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobOpen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobReOpen', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobClose', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobBytes', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobRead', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudBlobWrite', type: "inner", level: 2 }, - { title: "Pub/Sub APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudSetPubSubCallback', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudSetPubSubOnly', type: "inner", level: 2 }, - { title: "Upload/Download APIs", type: "inner", level: 1 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudUploadDatabase', type: "inner", level: 2 }, - { filePath: 'sqlite-cloud/sdks/c/SQCloudDownloadDatabase', type: "inner", level: 2 }, - - { title: "JavaScript", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-js-introduction", level: 1 }, - { title: "Quick Starts", type: "inner", level: 1 }, - { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, - { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, - { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, - { title: "Tutorials", type: "inner", level: 1 }, - { title: "Using SQLite Extensions - Geopoly", ref: "/docs/tutorial-geopoly", type: "inner", level: 2 }, - { title: "Classes", type: "inner", level: 1 }, - { title: "Database", filePath: 'sqlite-cloud/sdks/js/classes/Database', type: "inner", level: 2 }, - { title: "SQLiteCloudConnection", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudConnection', type: "inner", level: 2 }, - { title: "SQLiteCloudError", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudError', type: "inner", level: 2 }, - { title: "SQLiteCloudRow", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRow', type: "inner", level: 2 }, - { title: "SQLiteCloudRowset", filePath: 'sqlite-cloud/sdks/js/classes/SQLiteCloudRowset', type: "inner", level: 2 }, - { title: "SQLiteCloudStatement", filePath: 'sqlite-cloud/sdks/js/classes/Statement', type: "inner", level: 2 }, - - { title: 'Interfaces', type: "inner", level: 1 }, - { title: "SQLCloudRowsetMetadata", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata', type: "inner", level: 2 }, - { title: "SQLiteCloudConfig", filePath: 'sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig', type: "inner", level: 2 }, - { title: "Modules", filePath: "sdk-js-modules", type: "inner", level: 1 }, - - - { title: "Python", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-python-introduction", level: 1 }, - { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, - { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", ref: "/docs/quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - - { title: "Go", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-go-introduction", level: 1 }, - - { title: "PHP", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-php-introduction", level: 1 }, - { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, - - { title: "Swift", type: "inner", level: 0 }, - { title: 'Introduction', type: "inner", filePath: "sdk-swift-introduction", level: 1 }, - - { title: "Reference", type: "secondary", icon: "docs-ref" }, - { title: "Server-side Commands", type: "inner", level: 0 }, - { title: "Introduction", filePath: "server-side-commands", type: "inner", level: 1 }, - { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, - { title: "Authentication", filePath: "auth-commands", type: "inner", level: 1 }, - { title: "Backups", filePath: "backup-commands", type: "inner", level: 1 }, - { title: "Cluster", filePath: "cluster-commands", type: "inner", level: 1 }, - { title: "Database", filePath: "database-commands", type: "inner", level: 1 }, - { title: "General Info", filePath: "general-commands", type: "inner", level: 1 }, - { title: "IP", filePath: "ip-commands", type: "inner", level: 1 }, - { title: "Logs", filePath: "log-commands", type: "inner", level: 1 }, - { title: "Plugins", filePath: "plugin-commands", type: "inner", level: 1 }, - { title: "Privileges", filePath: "privilege-commands", type: "inner", level: 1 }, - { title: "Pub/Sub", filePath: "pub-sub-commands", type: "inner", level: 1 }, - { title: "Query Analyzer", filePath: "query-analyzer-commands", type: "inner", level: 1 }, - { title: "Roles", filePath: "role-commands", type: "inner", level: 1 }, - { title: "Settings", filePath: "settings-commands", type: "inner", level: 1 }, - { title: "User", filePath: "user-commands", type: "inner", level: 1 }, - - { title: "CLI", type: "inner", level: 0 }, - { title: "Introduction", filePath: "cli-commands", type: "inner", level: 1 }, - - { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite/" } + { title: "", type: "primary" }, + { + title: "Introduction", + filePath: "overview", + type: "secondary", + icon: "docs-star", + }, + { title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Getting Started", type: "inner", level: 0 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { + title: "Creating a database", + filePath: "create-database", + type: "inner", + level: 1, + }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, + { title: "Quick Start Guides", type: "inner", level: 0 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + { + title: "React Native", + filePath: "quick-start-react-native", + type: "inner", + level: 1, + }, + { + title: "Apollo / GraphQL", + filePath: "quick-start-apollo-graphql", + type: "inner", + level: 1, + }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + filePath: "quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + { + title: "Streamlit", + filePath: "quick-start-streamlit", + type: "inner", + level: 1, + }, + { + title: "PHP / Laravel", + filePath: "quick-start-php-laravel", + type: "inner", + level: 1, + }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Tutorials", type: "inner", level: 0 }, + { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, + { title: "Integrations", type: "inner", level: 0 }, + { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, + { title: "Platform", type: "secondary", icon: "docs-plat" }, + { + title: "Edge Functions", + filePath: "edge-functions", + type: "inner", + level: 0, + }, + { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, + { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + { title: "Vector", filePath: "vector", type: "inner", level: 0 }, + { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, + { + title: "Security and Access Control", + filePath: "security", + type: "inner", + level: 0, + }, + { title: "Backups", filePath: "backups", type: "inner", level: 0 }, + { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, + // { title: "Storage", type: "inner", level: 0 }, + // { title: "Partitioning", type: "inner", level: 0 }, + + { title: "SDKs", type: "secondary", icon: "docs-sdk" }, + { title: "C/C++", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-c-introduction", + level: 1, + }, + { title: "Basic APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudConnect", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudConnectWithString", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudExec", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudExecArray", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudUUID", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudDisconnect", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudConfig", type: "inner", level: 2 }, + + { title: "Result APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultIsOK", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultIsError", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultType", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudResultLen", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultInt32", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultInt64", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultFloat", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultDouble", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultFree", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudResultDump", + type: "inner", + level: 2, + }, + + { title: "Rowset APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetValueType", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetColumnName", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetInt32Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetInt64Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetFloatValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetDoubleValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudRowsetDump", + type: "inner", + level: 2, + }, + + { title: "Array APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayValueType", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayCount", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayInt32Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayInt64Value", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayFloatValue", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudArrayDoubleValue", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudArrayDump", type: "inner", level: 2 }, + + { title: "Error APIs", type: "inner", level: 1 }, + { + title: "SQCloudIsError", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudIsSQLiteError", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorCode", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudExtendedErrorCode", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorOffset", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + { + title: "SQCloudErrorMsg", + filePath: "sqlite-cloud/sdks/c/SQCloudError", + type: "inner", + level: 2, + }, + + { title: "VM APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMCompile", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMStep", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMResult", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMClose", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMErrorMsg", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMErrorCode", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsReadOnly", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsExplain", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMIsFinalized", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterCount", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMBindParameterName", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumnCount", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindDouble", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindInt", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindInt64", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindNull", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindText", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMBindZeroBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMBind", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnBlob", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnText", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnDouble", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnInt32", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnInt64", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnLen", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + title: "SQCloudVMColumnType", + filePath: "sqlite-cloud/sdks/c/SQCloudVMColumn", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMLastRowID", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudVMChanges", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudVMTotalChanges", + type: "inner", + level: 2, + }, + { title: "Blob APIs", type: "inner", level: 1 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobOpen", type: "inner", level: 2 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudBlobReOpen", + type: "inner", + level: 2, + }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobClose", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobBytes", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobRead", type: "inner", level: 2 }, + { filePath: "sqlite-cloud/sdks/c/SQCloudBlobWrite", type: "inner", level: 2 }, + { title: "Pub/Sub APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudSetPubSubCallback", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudSetPubSubOnly", + type: "inner", + level: 2, + }, + { title: "Upload/Download APIs", type: "inner", level: 1 }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudUploadDatabase", + type: "inner", + level: 2, + }, + { + filePath: "sqlite-cloud/sdks/c/SQCloudDownloadDatabase", + type: "inner", + level: 2, + }, + + { title: "JavaScript", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-js-introduction", + level: 1, + }, + { title: "Quick Starts", type: "inner", level: 1 }, + { title: "React", ref: "/docs/quick-start-react", type: "inner", level: 2 }, + { title: "Node.js", ref: "/docs/quick-start-node", type: "inner", level: 2 }, + { title: "Next.js", ref: "/docs/quick-start-next", type: "inner", level: 2 }, + { title: "Tutorials", type: "inner", level: 1 }, + { + title: "Using SQLite Extensions - Geopoly", + ref: "/docs/tutorial-geopoly", + type: "inner", + level: 2, + }, + { title: "Classes", type: "inner", level: 1 }, + { + title: "Database", + filePath: "sqlite-cloud/sdks/js/classes/Database", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudConnection", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudConnection", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudError", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudError", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudRow", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudRow", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudRowset", + filePath: "sqlite-cloud/sdks/js/classes/SQLiteCloudRowset", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudStatement", + filePath: "sqlite-cloud/sdks/js/classes/Statement", + type: "inner", + level: 2, + }, + + { title: "Interfaces", type: "inner", level: 1 }, + { + title: "SQLCloudRowsetMetadata", + filePath: "sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata", + type: "inner", + level: 2, + }, + { + title: "SQLiteCloudConfig", + filePath: "sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig", + type: "inner", + level: 2, + }, + { title: "Modules", filePath: "sdk-js-modules", type: "inner", level: 1 }, + + { title: "Python", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-python-introduction", + level: 1, + }, + { title: "Django", ref: "/docs/quick-start-django", type: "inner", level: 1 }, + { title: "Flask", ref: "/docs/quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + ref: "/docs/quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + + { title: "Go", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-go-introduction", + level: 1, + }, + + { title: "PHP", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-php-introduction", + level: 1, + }, + { title: "Methods", filePath: "sdk-php-methods", type: "inner", level: 1 }, + + { title: "Swift", type: "inner", level: 0 }, + { + title: "Introduction", + type: "inner", + filePath: "sdk-swift-introduction", + level: 1, + }, + + { title: "Reference", type: "secondary", icon: "docs-ref" }, + { title: "Server-side Commands", type: "inner", level: 0 }, + { + title: "Introduction", + filePath: "server-side-commands", + type: "inner", + level: 1, + }, + { title: "API Keys", filePath: "api-key-commands", type: "inner", level: 1 }, + { + title: "Authentication", + filePath: "auth-commands", + type: "inner", + level: 1, + }, + { title: "Backups", filePath: "backup-commands", type: "inner", level: 1 }, + { title: "Cluster", filePath: "cluster-commands", type: "inner", level: 1 }, + { title: "Database", filePath: "database-commands", type: "inner", level: 1 }, + { + title: "General Info", + filePath: "general-commands", + type: "inner", + level: 1, + }, + { title: "IP", filePath: "ip-commands", type: "inner", level: 1 }, + { title: "Logs", filePath: "log-commands", type: "inner", level: 1 }, + { title: "Plugins", filePath: "plugin-commands", type: "inner", level: 1 }, + { + title: "Privileges", + filePath: "privilege-commands", + type: "inner", + level: 1, + }, + { title: "Pub/Sub", filePath: "pub-sub-commands", type: "inner", level: 1 }, + { + title: "Query Analyzer", + filePath: "query-analyzer-commands", + type: "inner", + level: 1, + }, + { title: "Roles", filePath: "role-commands", type: "inner", level: 1 }, + { title: "Settings", filePath: "settings-commands", type: "inner", level: 1 }, + { title: "User", filePath: "user-commands", type: "inner", level: 1 }, + + { title: "CLI", type: "inner", level: 0 }, + { title: "Introduction", filePath: "cli-commands", type: "inner", level: 1 }, + + { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite/" }, ]; -export default sidebarNav +export default sidebarNav; diff --git a/sqlite-cloud/introduction.mdx b/sqlite-cloud/introduction.mdx deleted file mode 100644 index 04228a3..0000000 --- a/sqlite-cloud/introduction.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Introduction to SQLite Cloud -description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. -category: getting-started -status: publish -slug: introduction ---- - -## Overview -**SQLite Cloud** is a managed, distributed relational database system built on top of the SQLite database engine. - -It has been designed from the ground up to ensure strong consistency across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution. This ensures that you can focus on your core tasks while relying on **SQLite Cloud** to handle the complexities of managing your databases. - -**SQLite Cloud** is written in ANSI C and GO, and it works on most POSIX systems like Linux, *BSD, and Mac OS X (Windows is supported too). You can use **SQLite Cloud** from the most popular programming languages or its REST API. - ---- - -## Architecture - -**SQLite Cloud** uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. - -**SQLite Cloud** supports all the SQLite features without any limitations. It is fully ACID compliant, supports non-deterministic SQL statements, and guarantees strong consistency across all your cluster nodes. This ensures that data read from any node in the system returns the most up-to-date version of the data that has been committed. - -In a distributed database system, where data is distributed across multiple nodes, ensuring strong consistency can be challenging due to the potential for network delays, node failures, and concurrent transactions. Maintaining strong consistency is crucial for ensuring that the system behaves as expected and that applications built on top of the system can rely on the accuracy and integrity of the data. - -## Features -SQLite Cloud provides a comprehensive suite of tools for building realtime, local-first applications. -* **Local Sync**: Query your local SQLite database and synchronize with the cloud and across devices in real-time (**In development**). -* **Offline-first**: Resolve conflicts between devices and the cloud with CRDTs (**In development**). -* **[Webhooks](/docs/webhooks)**: Send changes to your database to external endpoints, or use to trigger edge functions via HTTP, Websockets, or on database events like INSERT, UPDATE, and DELETE. -* **[Edge Functions](/docs/edge-functions)**: Run serverless functions on the same node that stores your data for low-latency operations. Trigger with webhooks or on database operations. -* **[Pub/Sub](/docs/pub-sub)**: Subscribe to changes in your database to replicate data, power notifications, and build multiplayer experiences. -* **Weblite**: Autogenerated REST APIs to interact with your database and edge functions. -* **[Query Analyzer](/docs/analyzer)**: Receive optimization recommendations for your queries to improve performance. -* **Multi-region Load Balancer**: Connect to SQLite Cloud from anywhere in the world and SQLite Cloud automatically routes traffic to the nearest node for optimal performance. diff --git a/sqlite-cloud/index.mdx b/sqlite-cloud/overview.mdx similarity index 99% rename from sqlite-cloud/index.mdx rename to sqlite-cloud/overview.mdx index 846ab7f..fcece7c 100644 --- a/sqlite-cloud/index.mdx +++ b/sqlite-cloud/overview.mdx @@ -3,6 +3,7 @@ title: Getting Started with SQLite Cloud description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. category: getting-started status: publish +slug: overview --- ## Overview From bac8f9f4bce519370da7292f20dae350db946645 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 5 Feb 2025 14:00:08 +0100 Subject: [PATCH 113/185] fixed build error --- sqlite-cloud/_nav.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 12a6683..1c4f14b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -4,11 +4,10 @@ const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, { title: "Introduction", - filePath: "overview", type: "secondary", icon: "docs-star", }, - { title: "Overview", href: "/docs/sqlite-cloud", type: "inner", level: 0 }, + { title: "Overview", filePath: "overview", type: "inner", level: 0 }, { title: "Getting Started", type: "inner", level: 0 }, { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, { From deea6400db3674f915d7486b8a2feab5a3ef35f2 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Wed, 26 Feb 2025 12:00:18 +0100 Subject: [PATCH 114/185] fix(nodejs): use isConnect() --- sqlite-cloud/quick-start-next.mdx | 2 +- sqlite-cloud/quick-start-node.mdx | 44 ++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 2bf623e..70b849d 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -53,7 +53,7 @@ export function DatabaseProvider({ children, config }: DatabaseProviderProps) { const dbRef = useRef(null); useEffect(() => { - if (dbRef.current) return; // Connection already exists + if (dbRef.current && dbRef.current.isConnected()) return; // Connection already exists try { dbRef.current = new Database(config.connectionString); diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index e8bb0d2..cb50f25 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -29,25 +29,43 @@ npm install express @sqlitecloud/drivers --save - Paste the following into your `index.js` file: ```javascript -const express = require('express'); -const { Database } = require('@sqlitecloud/drivers'); +const express = require("express"); +const { Database } = require("@sqlitecloud/drivers"); const app = express(); -const db = new Database(''); - -app.get('/albums', async (req, res) => { - const result = await db.sql` - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; +let db; + +function getDatabase() { + if (!db || !db.isConnected()) { + db = new Database("", (error) => { + if (error) { + console.log("Error during the connection", error); + } else { + console.log("Connected to the database"); + } + }); + } + + return db; +} + +app.get("/albums", async (req, res) => { + try { + const result = await getDatabase().sql(` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`); res.json(result); + } catch (error) { + res.status(500).json({ error: error.message }); + } }); app.listen(3000, () => { - console.log('Server running on port 3000'); + console.log("Server running on port 3000"); }); ``` 5. **Run your app** From 7a45a6e70f46ecab7d4618de1edec9b7de93e4ca Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 10 Mar 2025 11:18:41 +0100 Subject: [PATCH 115/185] fix(js): example always reconnect to db --- sqlite-cloud/quick-start-next.mdx | 2 -- sqlite-cloud/quick-start-node.mdx | 19 +++---------------- sqlite-cloud/quick-start-react-native.mdx | 4 ++-- sqlite-cloud/quick-start-react.mdx | 23 ++++++++++++++--------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 70b849d..e0e2509 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -53,8 +53,6 @@ export function DatabaseProvider({ children, config }: DatabaseProviderProps) { const dbRef = useRef(null); useEffect(() => { - if (dbRef.current && dbRef.current.isConnected()) return; // Connection already exists - try { dbRef.current = new Database(config.connectionString); diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index cb50f25..2ca563b 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -32,26 +32,13 @@ npm install express @sqlitecloud/drivers --save const express = require("express"); const { Database } = require("@sqlitecloud/drivers"); +const connectionString = process.env.SQLITECLOUD_CONNECTION_STRING const app = express(); -let db; - -function getDatabase() { - if (!db || !db.isConnected()) { - db = new Database("", (error) => { - if (error) { - console.log("Error during the connection", error); - } else { - console.log("Connected to the database"); - } - }); - } - - return db; -} app.get("/albums", async (req, res) => { try { - const result = await getDatabase().sql(` + const db = new Database(connectionString) + const result = await db.sql(` USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index fb142f8..01d7222 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -49,11 +49,11 @@ export default function App() { const db = new Database(''); const result = - await db.sql`USE DATABASE chinook.sqlite; + await db.sql(`USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`; + WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`); setAlbums(result); } diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index 022bb56..0d41622 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -29,20 +29,25 @@ cd sqlc-quickstart && npm install @sqlitecloud/drivers import { useEffect, useState } from "react"; import { Database } from '@sqlitecloud/drivers'; -const db = new Database(''); +const connectionString = process.env.SQLITECLOUD_CONNECTION_STRING function App() { const [data, setData] = useState([]); const getAlbums = async () => { - const result = await db.sql` - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; - setData(result); + try { + const db = new Database(connectionString) + const result = await db.sql(` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId + LIMIT 20;`); + setData(result); + } catch (err) { + // manage error case + } }; useEffect(() => { From 17d25798177c637d1c283e826ea80eb6b1c52446 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 10 Mar 2025 11:54:30 +0100 Subject: [PATCH 116/185] fix(js): handle exception --- sqlite-cloud/quick-start-node.mdx | 5 +++- sqlite-cloud/quick-start-react-native.mdx | 28 +++++++++++++++-------- sqlite-cloud/quick-start-react.mdx | 8 +++++-- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index 2ca563b..c6d440b 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -36,8 +36,9 @@ const connectionString = process.env.SQLITECLOUD_CONNECTION_STRING const app = express(); app.get("/albums", async (req, res) => { + const db; try { - const db = new Database(connectionString) + db = new Database(connectionString) const result = await db.sql(` USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist @@ -48,6 +49,8 @@ app.get("/albums", async (req, res) => { res.json(result); } catch (error) { res.status(500).json({ error: error.message }); + } finally { + db?.close(); } }); diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index 01d7222..b6506e2 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -46,16 +46,24 @@ export default function App() { useEffect(() => { async function getAlbums() { - const db = new Database(''); - - const result = - await db.sql(`USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`); - - setAlbums(result); + const db; + try { + db = new Database(''); + + const result = + await db.sql(`USE DATABASE chinook.sqlite; + SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist + FROM albums + INNER JOIN artists + WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`); + + setAlbums(result); + } + } catch (error) { + // manage error state + console.error(`getAlbums - ${error}`, error) + } finally { + db?.close(); } getAlbums(); diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index 0d41622..8b78bad 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -35,8 +35,9 @@ function App() { const [data, setData] = useState([]); const getAlbums = async () => { + const db; try { - const db = new Database(connectionString) + db = new Database(connectionString) const result = await db.sql(` USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist @@ -46,7 +47,10 @@ function App() { LIMIT 20;`); setData(result); } catch (err) { - // manage error case + // manage error state + console.error(`getAlbums - ${error}`, error); + } finally { + db?.close(); } }; From 2323c29db3b927ccd4cca7e2301ea6741f5d576c Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 11 Mar 2025 08:33:49 +0100 Subject: [PATCH 117/185] improving next.js quick start --- sqlite-cloud/quick-start-next.mdx | 177 +++++++----------------------- 1 file changed, 42 insertions(+), 135 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index e0e2509..42d7a36 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -23,155 +23,62 @@ npx create-next-app@latest sqlc-quickstart --js --no-tailwind --eslint --app --s cd sqlc-quickstart && npm install @sqlitecloud/drivers ``` 4. **Instantiate a connection** + - Create a `.env.local` file in the root of your Next.js project and add your SQLiteCloud connection string: +``bash +SQLITECLOUD_URL=your_connection_string_here +``` - The Database driver establishes a TLS connection when used in Node.js, and a websocket connection when used in the browser. - - It is recommended that you use the Database driver in client-side components. - - To share the connection across pages, you can instantiate the connection in a context provider with the ```use client``` directive. Below is a simplified sample implementation. - -```tsx -// src/app/context/DatabaseContext.tsx -'use client'; - -import { Database } from '@sqlitecloud/drivers'; -import { createContext, useContext, useEffect, useRef, useState } from 'react'; - -interface DatabaseContextType { - db: Database | null; - isConnecting: boolean; - error: Error | null; -} - -const DatabaseContext = createContext(undefined); - -interface DatabaseProviderProps { - children: React.ReactNode; - config: { connectionString: string } -} - -export function DatabaseProvider({ children, config }: DatabaseProviderProps) { - const [isConnecting, setIsConnecting] = useState(true); - const [error, setError] = useState(null); - const dbRef = useRef(null); - - useEffect(() => { - try { - dbRef.current = new Database(config.connectionString); - - // Handle connection events - dbRef.current.on('open', () => { - console.log('open') - setIsConnecting(false); - setError(null); - }); - - dbRef.current.on('error', (err: Error) => { - console.log('error') - setError(err); - setIsConnecting(false); - }); - - dbRef.current.on('close', () => { - console.log('closing') - setIsConnecting(false); - dbRef.current = null; - }); - - } catch (err) { - setError(err instanceof Error ? err : new Error('Failed to initialize database')); - setIsConnecting(false); - } - // Cleanup function - return () => { - if (dbRef.current) { - dbRef.current.close(); - dbRef.current = null; - } - }; - }, [config]); - return ( - - {children} - - ); -} - -export function useDatabaseConnection() { - const context = useContext(DatabaseContext); - - if (context === undefined) { - throw new Error('useDatabaseConnection must be used within a DatabaseProvider'); - } +--- - return context; -} -``` -5. **Query data** - - Click the ```Connect``` button in your account dashboard and copy the connection string. Replace `````` in ```page.js``` with your connection string. - - Replace the code in ```layout.js``` and ```page.js``` with the following snippets. +### Using SQLiteCloud in Next.js (App Router) -```jsx -// src/app/layout.js -export default function RootLayout({ children }) { - return ( - - - ' }}> - {children} - - - - ); -} -``` +#### Fetching Data in a Server Component -```jsx -// src/app/page.js -import { useDatabaseConnection } from './context/DatabaseContext'; -import { useEffect, useState } from "react"; -import { useDatabaseConnection } from "./useDatabaseConnection"; +If you want to fetch data directly from the server and render it in a Server Component, you can do: -export default function Home() { - const { db } = useDatabaseConnection(); - const [albums, setAlbums] = useState([]); - - useEffect(() => { - const getAlbums = async () => { - const result = await db.sql`USE DATABASE chinook.sqlite; +**app/albums/page.tsx (Server Component)** +```tsx +import { Database } from "sqlitecloud"; +import { unstable_noStore as noStore } from "next/cache"; + +export default async function AlbumsPage() { + noStore(); // Prevents Next.js from caching the database request + const db = new Database(process.env.SQLITECLOUD_URL!); + + try { + const result = await db.sql(` + USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId - LIMIT 20;`; - return result; - }; - - if (db) { - getAlbums().then((result) => { - setAlbums(result); - }); - } - }, [db]); - - return ( -
    -

    Albums

    -
      - {albums.map((album) => ( -
      {album.title}
      - ))} -
    -
    - ); + LIMIT 20; + `); + + return ( +
    +

    Albums

    +
      + {result.map((album: any) => ( +
    • + {album.title} - {album.artist} +
    • + ))} +
    +
    + ); + } catch (error) { + return

    Error loading albums: {error.message}

    ; + } finally { + db.close(); + } } ``` + + 5. **Run your app** ```bash npm run dev From 043b43393c28ff8c3df196ba596bea7320aa8aaf Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Tue, 11 Mar 2025 09:40:14 +0100 Subject: [PATCH 118/185] fix(js): typo --- sqlite-cloud/quick-start-node.mdx | 2 +- sqlite-cloud/quick-start-react-native.mdx | 12 ++++++------ sqlite-cloud/quick-start-react.mdx | 6 ++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quick-start-node.mdx index c6d440b..d68a932 100644 --- a/sqlite-cloud/quick-start-node.mdx +++ b/sqlite-cloud/quick-start-node.mdx @@ -36,7 +36,7 @@ const connectionString = process.env.SQLITECLOUD_CONNECTION_STRING const app = express(); app.get("/albums", async (req, res) => { - const db; + let db = null; try { db = new Database(connectionString) const result = await db.sql(` diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quick-start-react-native.mdx index b6506e2..b3e59cc 100644 --- a/sqlite-cloud/quick-start-react-native.mdx +++ b/sqlite-cloud/quick-start-react-native.mdx @@ -46,9 +46,9 @@ export default function App() { useEffect(() => { async function getAlbums() { - const db; + let db = null; try { - db = new Database(''); + db = new Database(''); const result = await db.sql(`USE DATABASE chinook.sqlite; @@ -58,12 +58,12 @@ export default function App() { WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`); setAlbums(result); - } - } catch (error) { + } catch (error) { // manage error state console.error(`getAlbums - ${error}`, error) - } finally { - db?.close(); + } finally { + db?.close(); + } } getAlbums(); diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quick-start-react.mdx index 8b78bad..51fcb77 100644 --- a/sqlite-cloud/quick-start-react.mdx +++ b/sqlite-cloud/quick-start-react.mdx @@ -29,15 +29,13 @@ cd sqlc-quickstart && npm install @sqlitecloud/drivers import { useEffect, useState } from "react"; import { Database } from '@sqlitecloud/drivers'; -const connectionString = process.env.SQLITECLOUD_CONNECTION_STRING - function App() { const [data, setData] = useState([]); const getAlbums = async () => { - const db; + let db = null; try { - db = new Database(connectionString) + db = new Database('') const result = await db.sql(` USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist From b3e64ba92193e5b08ff6b0c9ad5adb4e98b2675d Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 11 Mar 2025 11:06:09 +0100 Subject: [PATCH 119/185] updated next.js example --- sqlite-cloud/quick-start-next.mdx | 423 +++++++++++++++++++++++++++--- 1 file changed, 385 insertions(+), 38 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 42d7a36..646aa4a 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -6,84 +6,431 @@ status: publish slug: quick-start-next --- -In this quickstart, we will show you how to get started with SQLite Cloud and Next.js by building a simple application that connects to and reads from a SQLite Cloud database. +This quick start guide will walk you through setting up a Next.js application that connects to and queries a SQLite Cloud database. --- 1. **Set up a SQLite Cloud account** - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. - - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + - For this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. + 2. **Create a Next.js app** - - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. + - Use ```create-next-app``` to set up a new Next.js project. The following command creates a minimal app with TypeScript and the latest App Router, keeping the focus on querying data. ```bash -npx create-next-app@latest sqlc-quickstart --js --no-tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm +npx create-next-app@latest sqlc-quickstart --ts --no-tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm ``` + 3. **Install the SQLite Cloud SDK** ```bash cd sqlc-quickstart && npm install @sqlitecloud/drivers ``` -4. **Instantiate a connection** - - Create a `.env.local` file in the root of your Next.js project and add your SQLiteCloud connection string: -``bash -SQLITECLOUD_URL=your_connection_string_here + +4. **Configure the Database Connection** + - Create a `.env.local` file in the root of your Next.js project and add your SQLite Cloud connection string: +```bash +SQLITECLOUD_URL=sqlitecloud://abcd1234.global1.qwerty.sqlite.cloud:8860/chinook.sqlite?apikey=your-api-key +NEXT_PUBLIC_SQLITECLOUD_URL=sqlitecloud://abcd1234.global1.qwerty.sqlite.cloud:8860/chinook.sqlite?apikey=your-api-key ``` - - The Database driver establishes a TLS connection when used in Node.js, and a websocket connection when used in the browser. + - The database driver establishes a TLS connection in Node.js and a WebSocket connection in the browser. ---- +5. **Set Up the Folder Structure** +```bash +mkdir -p sqlc-quickstart/src/app/api/albums \ + sqlc-quickstart/src/app/components \ + sqlc-quickstart/src/constants + +touch sqlc-quickstart/src/app/api/albums/route.ts \ + sqlc-quickstart/src/app/components/GetAlbumsClient.tsx \ + sqlc-quickstart/src/app/components/GetAlbumsServer.tsx \ + sqlc-quickstart/src/app/components/UpdateAlbumsClient.tsx \ + sqlc-quickstart/src/constants/queries.ts \ + sqlc-quickstart/src/types.ts +``` + +6. **Define Data Types** +```ts +// +// src/type.ts (Server Component) +// + +export interface Album { + id: number; + title: string; + artist: string; +} + +``` + +7. **Define Queries** +```ts +// +// src/constants/queries.ts +// + +export const GET_ALBUMS = ` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId AS id, albums.Title AS title, artists.Name AS artist + FROM albums + INNER JOIN artists ON albums.ArtistId = artists.ArtistId + LIMIT 20; +`; + +export const GET_LAST_TEN_ALBUMS = ` + USE DATABASE chinook.sqlite; + SELECT albums.AlbumId AS id, albums.Title AS title, artists.Name AS artist + FROM albums + INNER JOIN artists ON albums.ArtistId = artists.ArtistId + ORDER BY albums.AlbumId DESC + LIMIT 10; +`; + +export const INSERT_ALBUM = ` + USE DATABASE chinook.sqlite; + INSERT INTO albums (Title, ArtistId) VALUES (?, ?); +`; +``` + +8. **Fetch Data via a Route Handler** + +You can create a route handler for handling `GET` and `POST` requests. + +```ts +// +// src/app/api/albums/route.ts (Route Handler) +// + +import { NextResponse } from "next/server"; +import { Database } from "@sqlitecloud/drivers"; +import { GET_LAST_TEN_ALBUMS, INSERT_ALBUM } from "@/constants/queries"; + +export async function GET() { + let db; + + try { + db = new Database(process.env.SQLITECLOUD_URL!); + const result = await db.sql(GET_LAST_TEN_ALBUMS); + + return NextResponse.json(result); + } catch (error) { + let message = "An unknown error occurred"; -### Using SQLiteCloud in Next.js (App Router) + if (error instanceof Error) { + message = error.message; + } -#### Fetching Data in a Server Component + return NextResponse.json({ error: message }, { status: 500 }); + } finally { + db?.close(); + } +} + +export async function POST(req: Request) { + const { title, artistId } = await req.json(); + let db; + + try { + db = new Database(process.env.SQLITECLOUD_URL!); + await db.sql(INSERT_ALBUM, ...[title, artistId]); + + return NextResponse.json({ success: true }); + } catch (error) { + let message = "An unknown error occurred"; + + if (error instanceof Error) { + message = error.message; + } + + return NextResponse.json({ error: message }, { status: 500 }); + } finally { + db?.close(); + } +} +``` -If you want to fetch data directly from the server and render it in a Server Component, you can do: +9. **Fetch Data in a Server Component** + +To fetch data directly from the server and render it in a Server Component: -**app/albums/page.tsx (Server Component)** ```tsx -import { Database } from "sqlitecloud"; +// +// src/app/components/GetAlbumsServer.tsx (Server Component) +// + +import { GET_ALBUMS } from "@/constants/queries"; +import { Album } from "@/types"; +import { Database } from "@sqlitecloud/drivers"; import { unstable_noStore as noStore } from "next/cache"; -export default async function AlbumsPage() { +export default async function GetAlbumsServer() { noStore(); // Prevents Next.js from caching the database request - const db = new Database(process.env.SQLITECLOUD_URL!); - + let db; + try { - const result = await db.sql(` - USE DATABASE chinook.sqlite; - SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist - FROM albums - INNER JOIN artists - WHERE artists.ArtistId = albums.ArtistId - LIMIT 20; - `); - + db = new Database(process.env.SQLITECLOUD_URL!); + const result = await db.sql(GET_ALBUMS); + return (
    -

    Albums

    -
      - {result.map((album: any) => ( -
    • - {album.title} - {album.artist} +

      + Albums (Server Component) +

      +
        + {result.map((album: Album) => ( +
      • + {album.title} -{" "} + {album.artist}
      • ))}
    ); } catch (error) { - return

    Error loading albums: {error.message}

    ; + let message = "An unknown error occurred"; + + if (error instanceof Error) { + message = error.message; + } + return

    Error loading albums: {message}

    ; } finally { - db.close(); + db?.close(); } } ``` +10. **Fetch Data in a Client Component** +Since the SQLite Cloud driver can run in the browser, you can use it directly in a Client Component without needing an API route. + +```tsx +// +// src/app/components/GetAlbumsClient.tsx (Client Component) +// + +"use client"; + +import { useEffect, useState } from "react"; +import { Database } from "@sqlitecloud/drivers"; +import { Album } from "@/types"; +import { GET_ALBUMS } from "@/constants/queries"; + +export default function GetAlbumsClient() { + const [albums, setAlbums] = useState([]); + const [error, setError] = useState(null); + + useEffect(() => { + async function fetchAlbums() { + let db; + try { + console.log(process.env.NEXT_PUBLIC_SQLITECLOUD_URL); + db = new Database(process.env.NEXT_PUBLIC_SQLITECLOUD_URL!); + const result = await db.sql(GET_ALBUMS); + setAlbums(result); + } catch (error) { + let message = "An unknown error occurred"; + + if (error instanceof Error) { + message = error.message; + } + setError(message); + } finally { + db?.close(); + } + } + + fetchAlbums(); + }, []); + if (error) return

    Error: {error}

    ; -5. **Run your app** + return ( +
    +

    Albums (Client Component)

    + {error ? ( +

    Error: {error}

    + ) : ( +
      + {albums.map((album) => ( +
    • + {album.title} -{" "} + {album.artist} +
    • + ))} +
    + )} +
    + ); +} +``` + +11. **Update Data in a Client Component** +You can also update data directly from a Client Component: + +```tsx +// +// src/app/components/UpdateAlbumsClient.tsx (Client Component) +// + +"use client"; + +import { useState, useEffect } from "react"; + +export default function UpdateAlbumsClient() { + const [albums, setAlbums] = useState< + { id: number; title: string; artist: string }[] + >([]); + const [loading, setLoading] = useState(false); + + // Function to fetch albums from the API route + async function fetchAlbums() { + try { + const res = await fetch("/api/albums"); + if (!res.ok) throw new Error("Failed to fetch albums"); + const data = await res.json(); + setAlbums(data); + } catch (error) { + console.error("Error fetching albums:", error); + } + } + + // Function to add a new album and then reload the albums list + async function addAlbum() { + setLoading(true); + + try { + // Generate a random album name + const randomAlbumTitle = `Album ${Math.random() + .toString(36) + .substring(7)}`; + + // Generate a random artist ID between 1 and 100 + const randomArtistId = Math.floor(Math.random() * 100) + 1; + + const res = await fetch("/api/albums", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + title: randomAlbumTitle, + artistId: randomArtistId, + }), + }); + + if (!res.ok) throw new Error("Failed to add album"); + + await fetchAlbums(); // Refresh album list after adding + } catch (error) { + console.error("Error adding album:", error); + } finally { + setLoading(false); + } + } + + // Fetch albums when component mounts + useEffect(() => { + fetchAlbums(); + }, []); + + return ( +
    + + +

    Latest Albums

    + {albums.length === 0 ? ( +

    No albums found.

    + ) : ( +
      + {albums.map((album) => ( +
    • + {album.title} -{" "} + {album.artist} +
    • + ))} +
    + )} +
    + ); +} + +``` + +12. **Create a Page to Display Components** + +Replace the content of `page.tsx` with: + +```tsx +// +// src/app/page.tsx (Unified Page) +// + +import GetAlbumsClient from "./components/GetAlbumsClient"; +import GetAlbumsServer from "./components/GetAlbumsServer"; +import UpdateAlbumsClient from "./components/UpdateAlbumsClient"; + +export default function page() { + return ( +
    +
    +

    Albums Overview

    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    + ); +} +``` + +Replace the content of `layout.tsx` with: + +```tsx +// +// src/app/layout.tsx +// + +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + + {/* ✅ Add Tailwind CDN */} + + + {children} + + ); +} + +``` + +13. **Run Your App** ```bash npm run dev ``` -6. **View your app** - - Open your browser and navigate to the localhost link provided by the previous command to see your app data. -And that's it! You've successfully built a Next app that reads data from a SQLite Cloud database. \ No newline at end of file +14. **View Your App** + - Open your browser and navigate to the provided localhost link to see your app in action. + + +--- + +Congratulations! You’ve successfully built a Next.js app that interacts with a SQLite Cloud database. \ No newline at end of file From fae66e8f313e809b1069f9719e9f33de4ffdcea8 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 11 Mar 2025 11:52:16 +0100 Subject: [PATCH 120/185] fixed Set Up the Folder Structure --- sqlite-cloud/quick-start-next.mdx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quick-start-next.mdx index 646aa4a..905e552 100644 --- a/sqlite-cloud/quick-start-next.mdx +++ b/sqlite-cloud/quick-start-next.mdx @@ -36,16 +36,16 @@ NEXT_PUBLIC_SQLITECLOUD_URL=sqlitecloud://abcd1234.global1.qwerty.sqlite.cloud:8 5. **Set Up the Folder Structure** ```bash -mkdir -p sqlc-quickstart/src/app/api/albums \ - sqlc-quickstart/src/app/components \ - sqlc-quickstart/src/constants - -touch sqlc-quickstart/src/app/api/albums/route.ts \ - sqlc-quickstart/src/app/components/GetAlbumsClient.tsx \ - sqlc-quickstart/src/app/components/GetAlbumsServer.tsx \ - sqlc-quickstart/src/app/components/UpdateAlbumsClient.tsx \ - sqlc-quickstart/src/constants/queries.ts \ - sqlc-quickstart/src/types.ts +mkdir -p src/app/api/albums +mkdir -p src/app/components +mkdir -p src/constants + +touch src/app/api/albums/route.ts +touch src/app/components/GetAlbumsClient.tsx +touch src/app/components/GetAlbumsServer.tsx +touch src/app/components/UpdateAlbumsClient.tsx +touch src/constants/queries.ts +touch src/types.ts ``` 6. **Define Data Types** From ab10858bd4f098aa8b8801842cc6ba4c59ef34b0 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Thu, 24 Apr 2025 12:58:10 +0200 Subject: [PATCH 121/185] feat(accessTokens): first draft --- sqlite-cloud/platform/access-tokens.mdx | 238 ++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 sqlite-cloud/platform/access-tokens.mdx diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx new file mode 100644 index 0000000..859da93 --- /dev/null +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -0,0 +1,238 @@ +--- +title: Access Tokens +description: Grant to your users, devices, tenant, access to SQLite Cloud services. +category: platform +status: publish +slug: access-tokens +--- + +# Access Token API + +Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. +All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. + +--- + +## Create a New Access Token + +### `POST /v2/tokens` + +Creates a new Access Token for a specific entity. +The `entityId` refers to any kind of resource you want to associate the Access Token with. It must be a unique ID in your system. +The `expiresAt` is a date time value to set an expiration, or `null` if it doesn't expire. + +>[!note] Store the Access Token securely. It will not be shown again. + +- **Authentication**: API Key + +#### Example + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:443/v2/tokens' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '{ + "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "name": "user-token", + "expiresAt": "2023-10-01 10:11:12" + }' +``` + +#### Example Response + +```json +{ + "data": { + "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", + "access_token_id": 134, + "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "name": "user-token", + "expiresAt": "2023-10-01 10:11:12", + "createdAt": "2023-09-01 10:11:12" + } +} +``` + +--- + +## Get Current Token Details (Access Token Only) + +### `GET /v2/tokens/details` + +Retrieves metadata about the token used to authenticate the request. + +- **Authentication**: Access Token + +#### Example + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:443/v2/tokens/details' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' +``` + +#### Example Response + +```json +{ + "data": { + "access_token_id": 134, + "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "name": "user-token", + "expiresAt": "2023-10-01 10:11:12", + "createdAt": "2023-09-01 10:11:12" + } +} +``` + +--- + +## Get Token Details (Using API Key) + +### `POST /v2/tokens/details` + +Lets you inspect an Access Token using your API Key. + +- **Authentication**: API Key + +#### Example + +```bash +curl -X 'POST' \ + 'https://.sqlite.cloud:443/v2/tokens/details' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '{ + "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" + }' +``` + +#### Example Response + +```json +{ + "data": { + "access_token_id": 134, + "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "name": "user-token", + "expiresAt": "2023-10-01 10:11:12", + "createdAt": "2023-09-01 10:11:12" + } +} +``` + +--- + +## Check Token Validity + +### `GET /v2/tokens/authorized` + +Checks whether the provided Access Token is valid and not expired. + +- **Authentication**: API Key or Access Token + +#### Example + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:443/v2/tokens/authorized' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' +``` + +--- + +## Update an Access Token + +### `PATCH /v2/tokens` + +Updates information of an Access Token. +The The `token` field is required; it specifies the Access Token to update. +Fields that can be updated: +- `name`. +- `expiresAt`: date time value or `null` to set no expiration. + +- **Authentication**: API Key + +#### Example + +```bash +curl -X 'PATCH' \ + 'https://.sqlite.cloud:443/v2/tokens' \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '{ + "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", + "name": "updated-user-token", + "expiresAt": "2024-12-31T23:59:59" + }' +``` + +--- + +## Revoke a Token + +### `DELETE /v2/tokens` + +Revokes the given token, making it immediately unusable. + +- **Authentication**: API Key, Access Token + +The `token` in the request is optional when the Access Token is used for the authentication. + +#### Example + +```bash +curl -X 'DELETE' \ + 'https://.sqlite.cloud:443/v2/tokens' \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -d '{ + "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" + }' +``` + +--- + +## List Tokens by Entity + +### `GET /v2/tokens/entities/{entityId}` + +Returns all non-expired tokens associated with the specified entity. + +- **Authentication**: API Key +- **Path Parameter**: `entityId` + +#### Example + +```bash +curl -X 'GET' \ + 'https://.sqlite.cloud:443/v2/tokens/entities/0195fc5b-96a6-7000-8b17-fd2420499c2c' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' +``` + +#### Example Response + +```json +{ + "data": [ + { + "name": "sqlitesync-user", + "expiresAt": "2024-11-01 00:00:00", + "createdAt": "2024-10-01 10:11:12" + }, + { + "name": "sqlitesync-user", + "expiresAt": null, + "createdAt": "2024-09-01 10:11:12" + } + ] +} +``` + +--- \ No newline at end of file From 24ce19c5595d129d58b900a30eba4204abb4aede Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Thu, 24 Apr 2025 17:10:43 +0200 Subject: [PATCH 122/185] feat(mcp): introduce mcp server --- sqlite-cloud/_nav.ts | 3 +- sqlite-cloud/platform/mcp-server.mdx | 147 +++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 sqlite-cloud/platform/mcp-server.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 1c4f14b..57f1c0a 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -81,8 +81,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, - // { title: "Storage", type: "inner", level: 0 }, - // { title: "Partitioning", type: "inner", level: 0 }, + { title: "AI - Model Context Protocol (MCP)", filePath: "mcp-server", type: "inner", level: 0 }, { title: "SDKs", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/mcp-server.mdx b/sqlite-cloud/platform/mcp-server.mdx new file mode 100644 index 0000000..34818b7 --- /dev/null +++ b/sqlite-cloud/platform/mcp-server.mdx @@ -0,0 +1,147 @@ +--- +title: AI - Model Context Protocol (MCP) +description: MCP Server for SQLite Cloud to interact with SQLite Cloud databases using the AI models +category: platform +status: publish +slug: mcp-server +--- + +The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is a standard for connecting various data sources (like your SQLite Cloud database) to Large Language Models (LLMs). The MCP Server for SQLite Cloud provides tools for executing queries, managing schemas, and analyzing query performance. + +## Features + +- **Query Execution**: Perform `SELECT`, `INSERT`, `UPDATE`, and `DELETE` SQL operations on SQLite Cloud databases. +- **Schema Management**: Create tables, list existing ones, and retrieve schema details. +- **Command Execution**: Run predefined commands supported by SQLite Cloud. +- **Performance Analysis**: Identify slow queries, analyze query plans, and reset query statistics. + +[Explore the available tools here](https://github.com/sqlitecloud/sqlitecloud-mcp-server). + +## Getting Started + +To use the MCP Server, create a [free account on SQLite Cloud](https://sqlitecloud.io) and obtain your **Connection String**. + +### Requirements + +You need [Node.js](https://nodejs.org) installed on your computer to run the MCP Server. To check if Node.js is installed, open a terminal: + +- **Linux**: Open the terminal from the Applications menu. +- **macOS**: Open the Terminal app from the Applications folder or use Spotlight Search (`Cmd+Space`) and type "Terminal." +- **Windows**: Press `Win + R`, type `cmd`, and press Enter to open the Command Prompt. Alternatively, search for "Command Prompt" in the Start menu. + +Then type the following command and press Enter: + +```bash +node --version +``` + +If the command returns a version number, Node.js is installed. If you see an error like "command not found" or "node is not recognized," download and install Node.js from [nodejs.org](https://nodejs.org). + +## Configure the AI Agent + +This guide explains how to connect the MCP Server for SQLite Cloud to common AI agents that support MCP. +[Find a list of supported tools and IDEs here](https://modelcontextprotocol.io/clients). + +After configuring your AI agent, try asking it questions about your SQLite Cloud database, such as: + +> What’s in my database on SQLite Cloud?" +"What are the three most popular tracks by revenue in my SQLite Cloud database? + +Explore or manipulate your database using natural language queries. + +### Claude Desktop + +Refer to the [official documentation](https://modelcontextprotocol.io/quickstart/user) for detailed instructions. + +1. Open Claude Desktop and navigate to **Settings**. +2. Go to the **Developer** section and click on **Edit Config** to open the configuration file. +3. Add the following configuration: + + ```json + { + "mcpServers": { + "sqlitecloud-mcp-server": { + "type": "stdio", + "command": "npx", + "args": [ + "-y", + "@sqlitecloud/mcp-server", + "--connectionString", + "" + ] + } + } + } + ``` + + Replace `` with your Connection String. + +4. Save the configuration file and restart Claude Desktop. +5. You should see a _Hammer_ icon in the bottom-right corner of the input box. Click the icon to view the list of discovered tools. + +### Cursor + +Refer to the [official documentation](https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers) for detailed instructions. + +1. In the root of your project, create the file `.cursor/mcp.json`. +2. Add the following configuration: + + ```json + { + "mcpServers": { + "sqlitecloud-mcp-server": { + "type": "stdio", + "command": "npx", + "args": [ + "-y", + "@sqlitecloud/mcp-server", + "--connectionString", + "" + ] + } + } + } + ``` + + Replace `` with your Connection String. + +3. Save the `mcp.json` file. +4. Open the **Settings** page and navigate to the **MCP** section. You should see the MCP server with a green status indicator. +5. In the Chat panel, select the "Agent" mode to interact with the AI model using the MCP Server. + +### VSCode Copilot + +Refer to the [official documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for detailed instructions. + +1. In the root of your project, create the file `.vscode/mcp.json`. +2. Add the following configuration: + + ```json + { + "mcp": { + "inputs": [ + { + "type": "promptString", + "id": "sqlitecloud-connection-string", + "description": "Set the SQLite Cloud Connection String", + "password": true + } + ], + "servers": { + "sqlitecloud-mcp-server": { + "type": "stdio", + "command": "npx", + "args": [ + "-y", + "@sqlitecloud/mcp-server", + "--connectionString", + "${input:sqlitecloud-connection-string}" + ] + } + } + } + } + ``` + +3. Save the `mcp.json` file. +4. Open Copilot Chat and select the **Agent** mode from the menu near the **Send** button. A tool icon will appear, showing the discovered tools. Before starting the server, VSCode will prompt you to enter your Connection String. From 18feff0dc1b23383437bfa3cf654ce2a48f013da Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:16:06 +0200 Subject: [PATCH 123/185] update docsearch action to use new 443 port --- .github/workflows/search.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 4a9ee05..2f86bbc 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -12,7 +12,7 @@ jobs: environment: ${{ github.ref_name }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: sqlitecloud/docsearch-action@v4 with: project-string: ${{ secrets.PROJECT_STRING }} From 2c1628d3f38b6c44dbea74024054a32216bad26c Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:17:43 +0200 Subject: [PATCH 124/185] wrong action version --- .github/workflows/search.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 2f86bbc..903abdf 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -12,8 +12,8 @@ jobs: environment: ${{ github.ref_name }} steps: - - uses: actions/checkout@v5 - - uses: sqlitecloud/docsearch-action@v4 + - uses: actions/checkout@v4 + - uses: sqlitecloud/docsearch-action@v5 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} From 7525abd4dc87ea54e3aaf3d9d19a806bec3643ab Mon Sep 17 00:00:00 2001 From: Gioele Cantoni Date: Mon, 28 Apr 2025 16:05:11 +0200 Subject: [PATCH 125/185] publish architecture/scaling --- sqlite-cloud/_nav.ts | 2 +- _architecture.mdx => sqlite-cloud/platform/architecture.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename _architecture.mdx => sqlite-cloud/platform/architecture.mdx (99%) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 57f1c0a..1932e34 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -70,7 +70,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, { title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Scaling", type: "inner", filePath: "scaling", level: 0 }, + { title: "Scaling", type: "inner", filePath: "architecture", level: 0 }, { title: "Security and Access Control", filePath: "security", diff --git a/_architecture.mdx b/sqlite-cloud/platform/architecture.mdx similarity index 99% rename from _architecture.mdx rename to sqlite-cloud/platform/architecture.mdx index 542fa94..ecf444f 100644 --- a/_architecture.mdx +++ b/sqlite-cloud/platform/architecture.mdx @@ -2,7 +2,7 @@ title: Architecture description: SQLite Cloud Architecture category: getting-started -status: draft +status: publish slug: architecture --- From e566c1630939bb7adf50382df82dd0c9a1991797 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Thu, 22 May 2025 16:13:36 +0200 Subject: [PATCH 126/185] fix(tokens): minor changes --- sqlite-cloud/platform/access-tokens.mdx | 60 ++++++++++++++----------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index 859da93..ec6c35c 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -1,6 +1,6 @@ --- title: Access Tokens -description: Grant to your users, devices, tenant, access to SQLite Cloud services. +description: Grant to your users, devices, tenant, access to SQLite Cloud database and services. category: platform status: publish slug: access-tokens @@ -8,7 +8,7 @@ slug: access-tokens # Access Token API -Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. +Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. --- @@ -17,9 +17,9 @@ All endpoints require authentication. Use an **API Key** or an **Access Token** ### `POST /v2/tokens` -Creates a new Access Token for a specific entity. -The `entityId` refers to any kind of resource you want to associate the Access Token with. It must be a unique ID in your system. -The `expiresAt` is a date time value to set an expiration, or `null` if it doesn't expire. +Creates a new Access Token for a specific user. +The `userId` refers to your user's id or any kind of resource you want to associate the Access Token to. It must be a unique ID in your system. +The `expiresAt` is a date time value to set expiration, or `null` if it doesn't expire. >[!note] Store the Access Token securely. It will not be shown again. @@ -29,12 +29,13 @@ The `expiresAt` is a date time value to set an expiration, or `null` if it doesn ```bash curl -X 'POST' \ - 'https://.sqlite.cloud:443/v2/tokens' \ + 'https://.sqlite.cloud/v2/tokens' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -H 'Authorization: Bearer ' \ -d '{ - "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", "name": "user-token", + "attributes": "{\"role\":\"myrole\"}", "expiresAt": "2023-10-01 10:11:12" }' ``` @@ -46,8 +47,9 @@ curl -X 'POST' \ "data": { "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", "access_token_id": 134, - "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", "name": "user-token", + "attributes": "{\"role\":\"myrole\"}", "expiresAt": "2023-10-01 10:11:12", "createdAt": "2023-09-01 10:11:12" } @@ -68,7 +70,7 @@ Retrieves metadata about the token used to authenticate the request. ```bash curl -X 'GET' \ - 'https://.sqlite.cloud:443/v2/tokens/details' \ + 'https://.sqlite.cloud/v2/tokens/details' \ -H 'accept: application/json' \ -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' ``` @@ -79,8 +81,9 @@ curl -X 'GET' \ { "data": { "access_token_id": 134, - "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", "name": "user-token", + "attributes": null, "expiresAt": "2023-10-01 10:11:12", "createdAt": "2023-09-01 10:11:12" } @@ -101,9 +104,9 @@ Lets you inspect an Access Token using your API Key. ```bash curl -X 'POST' \ - 'https://.sqlite.cloud:443/v2/tokens/details' \ + 'https://.sqlite.cloud/v2/tokens/details' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -H 'Authorization: Bearer ' \ -d '{ "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" }' @@ -115,8 +118,9 @@ curl -X 'POST' \ { "data": { "access_token_id": 134, - "entityId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", + "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", "name": "user-token", + "attributes": null, "expiresAt": "2023-10-01 10:11:12", "createdAt": "2023-09-01 10:11:12" } @@ -137,11 +141,15 @@ Checks whether the provided Access Token is valid and not expired. ```bash curl -X 'GET' \ - 'https://.sqlite.cloud:443/v2/tokens/authorized' \ + 'https://.sqlite.cloud/v2/tokens/authorized' \ -H 'accept: application/json' \ -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' ``` +#### Example Response + +HTTP Status **204** or **401** if not valid or expired. + --- ## Update an Access Token @@ -149,7 +157,7 @@ curl -X 'GET' \ ### `PATCH /v2/tokens` Updates information of an Access Token. -The The `token` field is required; it specifies the Access Token to update. +The `token` field is required, it specifies the Access Token to update. Fields that can be updated: - `name`. - `expiresAt`: date time value or `null` to set no expiration. @@ -160,10 +168,10 @@ Fields that can be updated: ```bash curl -X 'PATCH' \ - 'https://.sqlite.cloud:443/v2/tokens' \ + 'https://.sqlite.cloud/v2/tokens' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -H 'Authorization: Bearer ' \ -d '{ "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", "name": "updated-user-token", @@ -187,10 +195,10 @@ The `token` in the request is optional when the Access Token is used for the aut ```bash curl -X 'DELETE' \ - 'https://.sqlite.cloud:443/v2/tokens' \ + 'https://.sqlite.cloud/v2/tokens' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' \ + -H 'Authorization: Bearer ' \ -d '{ "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" }' @@ -198,22 +206,22 @@ curl -X 'DELETE' \ --- -## List Tokens by Entity +## List Tokens by User -### `GET /v2/tokens/entities/{entityId}` +### `GET /v2/tokens/users/{userId}` -Returns all non-expired tokens associated with the specified entity. +Returns all non-expired tokens associated with the specified user. - **Authentication**: API Key -- **Path Parameter**: `entityId` +- **Path Parameter**: `userId` #### Example ```bash curl -X 'GET' \ - 'https://.sqlite.cloud:443/v2/tokens/entities/0195fc5b-96a6-7000-8b17-fd2420499c2c' \ + 'https://.sqlite.cloud/v2/tokens/users/0195fc5b-96a6-7000-8b17-fd2420499c2c' \ -H 'accept: application/json' \ - -H 'Authorization: Bearer sqlitecloud://.sqlite.cloud:8860?apikey=' + -H 'Authorization: Bearer ' ``` #### Example Response From 4c64125fc7073de23f56948b726a4c923de0b394 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 26 May 2025 11:59:42 +0200 Subject: [PATCH 127/185] feat(accessTokens): explain the access tokens example --- sqlite-cloud/platform/access-tokens.mdx | 273 +++++------------------- 1 file changed, 55 insertions(+), 218 deletions(-) diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index ec6c35c..cca2b33 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -8,239 +8,76 @@ slug: access-tokens # Access Token API -Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. -All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. +Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. ---- - -## Create a New Access Token - -### `POST /v2/tokens` - -Creates a new Access Token for a specific user. -The `userId` refers to your user's id or any kind of resource you want to associate the Access Token to. It must be a unique ID in your system. -The `expiresAt` is a date time value to set expiration, or `null` if it doesn't expire. - ->[!note] Store the Access Token securely. It will not be shown again. - -- **Authentication**: API Key - -#### Example - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud/v2/tokens' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer ' \ - -d '{ - "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", - "name": "user-token", - "attributes": "{\"role\":\"myrole\"}", - "expiresAt": "2023-10-01 10:11:12" - }' -``` - -#### Example Response - -```json -{ - "data": { - "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", - "access_token_id": 134, - "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", - "name": "user-token", - "attributes": "{\"role\":\"myrole\"}", - "expiresAt": "2023-10-01 10:11:12", - "createdAt": "2023-09-01 10:11:12" - } -} -``` +API Documentation can be found in the **Weblite** section in the [Dashboard](https://dashboard.sqlitecloud.io). --- -## Get Current Token Details (Access Token Only) - -### `GET /v2/tokens/details` +In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples), we created a simple app to demonstrate how to generate and use Access Tokens. -Retrieves metadata about the token used to authenticate the request. +We’ll log in with Google, grab a token, and use it to interact with SQLite Cloud Weblite APIs. Here’s how it works. -- **Authentication**: Access Token +## Generate a new Access Token -#### Example +In the snippet below, we handle the Google Login callback when the user has completed the login on Google. Here, you can exchange the `code` with the Google Access Token and then decide what to do with it as needed. -```bash -curl -X 'GET' \ - 'https://.sqlite.cloud/v2/tokens/details' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' -``` - -#### Example Response - -```json -{ - "data": { - "access_token_id": 134, - "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", - "name": "user-token", - "attributes": null, - "expiresAt": "2023-10-01 10:11:12", - "createdAt": "2023-09-01 10:11:12" +```typescript +if (pathname === "/auth/callback") { + const q = query; + if (q.state !== STATE || !q.code) { + return send(res, 400, "Invalid state or missing code"); } -} -``` ---- - -## Get Token Details (Using API Key) - -### `POST /v2/tokens/details` - -Lets you inspect an Access Token using your API Key. - -- **Authentication**: API Key - -#### Example - -```bash -curl -X 'POST' \ - 'https://.sqlite.cloud/v2/tokens/details' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer ' \ - -d '{ - "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" - }' + try { + // Exchange code for tokens + // Store the Google Token in the database + const googleToken = await getGoogleTokens(q.code as string); + ... ``` -#### Example Response - -```json -{ - "data": { - "access_token_id": 134, - "userId": "0195fc5b-96a6-7000-8b17-fd2420499c2c", - "name": "user-token", - "attributes": null, - "expiresAt": "2023-10-01 10:11:12", - "createdAt": "2023-09-01 10:11:12" +Now we have authenticated the user, we are ready to request SQLite Cloud to create a new SQLite Cloud Access Token to assign to the this user. + +```typescript +async function getSQLiteCloudToken(userId: string) { + const payload = { + name: "test-user-token", // A name for the token, can be anything you want + userId, + expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24).toISOString(), // expires in 24 hours + }; + + const res = await fetch(SQLITE_CLOUD_API_TOKENS, { + method: "POST", + headers: { + Authorization: `Bearer ${SQLITE_CLOUD_API_KEY}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + }); + if (!res.ok) { + throw new Error(`Failed to create SQLite Cloud token: ${res.statusText}`); } -} -``` - ---- - -## Check Token Validity - -### `GET /v2/tokens/authorized` - -Checks whether the provided Access Token is valid and not expired. - -- **Authentication**: API Key or Access Token - -#### Example -```bash -curl -X 'GET' \ - 'https://.sqlite.cloud/v2/tokens/authorized' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer 134|sqla_abcdeabcdeabcdeabcdeabcdeabcde' -``` - -#### Example Response - -HTTP Status **204** or **401** if not valid or expired. - ---- - -## Update an Access Token - -### `PATCH /v2/tokens` - -Updates information of an Access Token. -The `token` field is required, it specifies the Access Token to update. -Fields that can be updated: -- `name`. -- `expiresAt`: date time value or `null` to set no expiration. - -- **Authentication**: API Key - -#### Example - -```bash -curl -X 'PATCH' \ - 'https://.sqlite.cloud/v2/tokens' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer ' \ - -d '{ - "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde", - "name": "updated-user-token", - "expiresAt": "2024-12-31T23:59:59" - }' -``` - ---- - -## Revoke a Token - -### `DELETE /v2/tokens` - -Revokes the given token, making it immediately unusable. - -- **Authentication**: API Key, Access Token - -The `token` in the request is optional when the Access Token is used for the authentication. - -#### Example - -```bash -curl -X 'DELETE' \ - 'https://.sqlite.cloud/v2/tokens' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -H 'Authorization: Bearer ' \ - -d '{ - "token": "134|sqla_abcdeabcdeabcdeabcdeabcdeabcde" - }' -``` - ---- - -## List Tokens by User - -### `GET /v2/tokens/users/{userId}` - -Returns all non-expired tokens associated with the specified user. - -- **Authentication**: API Key -- **Path Parameter**: `userId` - -#### Example - -```bash -curl -X 'GET' \ - 'https://.sqlite.cloud/v2/tokens/users/0195fc5b-96a6-7000-8b17-fd2420499c2c' \ - -H 'accept: application/json' \ - -H 'Authorization: Bearer ' + return res.json(); +} ``` -#### Example Response - -```json -{ - "data": [ - { - "name": "sqlitesync-user", - "expiresAt": "2024-11-01 00:00:00", - "createdAt": "2024-10-01 10:11:12" - }, - { - "name": "sqlitesync-user", - "expiresAt": null, - "createdAt": "2024-09-01 10:11:12" - } - ] -} +In the response JSON, the `data.token` field contains the Access Token. + +Finally, the user is authorized to securely access SQLite Cloud services like the Weblite API to perform a query on the database: + +```typescript +const res = await fetch(sqliteCloudApiQuery, { + method: "POST", + headers: { + Authorization: "Bearer " + sqliteCloudToken, + "Content-Type": "application/json", + }, + body: JSON.stringify({ + sql: "USE DATABASE chinook.sqlite;SELECT * FROM artists LIMIT 10;", + }), +}); +... ``` ---- \ No newline at end of file +The results depend on the [Row Level Security](https://) you enabled for the tables. From 1e5e1f2219f44b8444100952d1d3f8c439bc2b42 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 26 May 2025 12:18:57 +0200 Subject: [PATCH 128/185] fix(accessTokens): missing nav reference --- sqlite-cloud/_nav.ts | 6 ++++++ sqlite-cloud/platform/access-tokens.mdx | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 1c4f14b..7a3e559 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -77,6 +77,12 @@ const sidebarNav: SidebarNavStruct = [ type: "inner", level: 0, }, + { + title: "Access Tokens", + filePath: "access-tokens", + type: "inner", + level: 0, + }, { title: "Backups", filePath: "backups", type: "inner", level: 0 }, { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index cca2b33..e7850d9 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -6,8 +6,6 @@ status: publish slug: access-tokens --- -# Access Token API - Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. API Documentation can be found in the **Weblite** section in the [Dashboard](https://dashboard.sqlitecloud.io). From fd5da604a9783d38d2f0f8cc4edae4ae005f1d0c Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 26 May 2025 12:32:15 +0200 Subject: [PATCH 129/185] fix(accessTokens): typos --- sqlite-cloud/platform/access-tokens.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index e7850d9..d46f390 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -8,16 +8,16 @@ slug: access-tokens Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. -API Documentation can be found in the **Weblite** section in the [Dashboard](https://dashboard.sqlitecloud.io). +The API Documentation for the Access Tokens API can be found in the **Weblite** section in the [Dashboard](https://dashboard.sqlitecloud.io). --- +## Example App + In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples), we created a simple app to demonstrate how to generate and use Access Tokens. We’ll log in with Google, grab a token, and use it to interact with SQLite Cloud Weblite APIs. Here’s how it works. -## Generate a new Access Token - In the snippet below, we handle the Google Login callback when the user has completed the login on Google. Here, you can exchange the `code` with the Google Access Token and then decide what to do with it as needed. ```typescript @@ -34,7 +34,7 @@ if (pathname === "/auth/callback") { ... ``` -Now we have authenticated the user, we are ready to request SQLite Cloud to create a new SQLite Cloud Access Token to assign to the this user. +Now we have authenticated the user, we are ready to request SQLite Cloud to create a new SQLite Cloud Access Token assigned to this user. ```typescript async function getSQLiteCloudToken(userId: string) { @@ -44,7 +44,7 @@ async function getSQLiteCloudToken(userId: string) { expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24).toISOString(), // expires in 24 hours }; - const res = await fetch(SQLITE_CLOUD_API_TOKENS, { + const res = await fetch("https:///v2/tokens", { method: "POST", headers: { Authorization: `Bearer ${SQLITE_CLOUD_API_KEY}`, @@ -65,7 +65,7 @@ In the response JSON, the `data.token` field contains the Access Token. Finally, the user is authorized to securely access SQLite Cloud services like the Weblite API to perform a query on the database: ```typescript -const res = await fetch(sqliteCloudApiQuery, { +const res = await fetch("https:///v2/weblite/sql", { method: "POST", headers: { Authorization: "Bearer " + sqliteCloudToken, @@ -78,4 +78,4 @@ const res = await fetch(sqliteCloudApiQuery, { ... ``` -The results depend on the [Row Level Security](https://) you enabled for the tables. +The result depends on the [Row Level Security](https://) you enabled for the tables. From ed7b1f4cd63942b3dd9c17753b95f36311a9412e Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 26 May 2025 12:38:19 +0200 Subject: [PATCH 130/185] fix(accessTokens): typos --- sqlite-cloud/platform/access-tokens.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index d46f390..7ed23c1 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -12,7 +12,7 @@ The API Documentation for the Access Tokens API can be found in the **Weblite** --- -## Example App +## Example Using SQLite Cloud Access Tokens with Google Login In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples), we created a simple app to demonstrate how to generate and use Access Tokens. From 591fab0a94179131a0db49893e1eb682c743c7c8 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Mon, 14 Jul 2025 10:34:01 +0200 Subject: [PATCH 131/185] add new docs page for RLS --- sqlite-cloud/_nav.ts | 6 + sqlite-cloud/platform/rls.mdx | 228 ++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 sqlite-cloud/platform/rls.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index bc3d317..de07b69 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -77,6 +77,12 @@ const sidebarNav: SidebarNavStruct = [ type: "inner", level: 0, }, + { + title: "Row-Level Security", + filePath: "rls", + type: "inner", + level: 0, + }, { title: "Access Tokens", filePath: "access-tokens", diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx new file mode 100644 index 0000000..8fd6ee6 --- /dev/null +++ b/sqlite-cloud/platform/rls.mdx @@ -0,0 +1,228 @@ +--- +title: Row-Level Security +description: Configure fine-grained access control policies to determine which rows in a table a user can access. +category: platform +status: publish +slug: rls +--- + +import Callout from "@commons-components/Information/Callout.astro"; + +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. + + +RLS rules only affect users who are authenticated using tokens. Admins, APIKEYs, or other non-token users are not restricted by RLS. + + +RLS is a powerful feature for building secure, multi-tenant applications. When combined with [SQLite Sync](https://github.com/sqliteai/sqlite-sync), it enables you to create robust **local-first apps** where user data is stored on the device for offline availability and superior performance. + +This architecture simplifies development by allowing your application to interact with a local database while SQLite Cloud 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. + +## Policy Enforcement + +RLS in SQLite Cloud operates based on the following principles: + +Access is denied by default. + +Unless explicitly allowed by RLS rules, access is blocked. Specifically: + +- If RLS is enabled and rules are defined, only permitted operations will succeed. +- If RLS is enabled but a rule is missing for an operation (e.g., `SELECT`), that operation will be denied. +- If RLS is not enabled or not configured for a table, token-authenticated users won't see any rows at all. + +To make data accessible to token-authenticated users, you must both enable RLS for the table and define rules for the desired operations (like `SELECT`, `INSERT`, etc.). + +Otherwise, they will be blocked from accessing any rows. + +## Configuring RLS + +You can configure RLS policies for your databases through the SQLite Cloud dashboard. + +1. **Navigate to the Databases Page**: From the main dashboard, go to the "Databases" page. +2. **Select the RLS Column**: In the list of your databases, click on the button in the "RLS" column for the desired database. + + ![Dashboard Databases Page](@docs-website-assets/introduction/rls-1.png) + +3. **Configure RLS Settings**: On the RLS settings page, you can define the policies for each table. + + ![Dashboard RLS Settings Page](@docs-website-assets/introduction/rls-2.png) + + For each table, you can specify the following RLS policies: + + - **SELECT**: A SQL expression that determines which rows a user can `SELECT`. + - **INSERT**: A SQL expression that determines if a user can `INSERT` a new row. + - **UPDATE**: A SQL expression that determines which rows a user can `UPDATE`. + - **DELETE**: A SQL expression that determines which rows a user can `DELETE`. + + + 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. + + +### User Information Functions + +To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user: + +- `auth_userid()`: Returns the `userid` of the current token-authenticated user. +- `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`. + +These functions are particularly useful for creating policies that are based on user attributes. + +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/). + +### OLD and NEW References + +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: + +| Operation | `OLD.column` Reference | `NEW.column` Reference | +| :--- | :--- | :--- | +| `INSERT` | Not available | The value for the new row. | +| `UPDATE` | The value of the row *before* the update. | The value of the row *after* the update. | +| `DELETE` | The value of the row being deleted. | Not available | + +## Example + +Suppose you have a `tasks` table with the following schema: + +```sql +CREATE TABLE tasks ( + id INTEGER PRIMARY KEY, + title TEXT, + owner_id INTEGER, + status TEXT +); +``` + +Here are a few examples of RLS policies you can create: + +**1. Users can only see their own tasks.** + +```sql +-- SELECT policy +owner_id = auth_userid() +``` + +**2. Users can only insert tasks for themselves.** + +```sql +-- INSERT policy +NEW.owner_id = auth_userid() +``` + +**3. Users can only update the status of their own tasks.** + +```sql +-- UPDATE policy +OLD.owner_id = auth_userid() +``` + +**4. Users with the 'admin' group can see all tasks.** + +```sql +-- SELECT policy +json_extract(auth_json(), '$.attributes.group') = 'admin' +``` + +**5. Role-Based Access within a Tenancy** + +```sql +-- SELECT policy +org_id = json_extract(auth_json(), '$.attributes.org_id') AND +(json_extract(auth_json(), '$.attributes.role') = 'admin' OR owner_id = auth_userid()) +``` + +**6. Access via a Membership Linking Table** + +```sql +-- SELECT policy +EXISTS ( + SELECT 1 FROM project_members + WHERE project_members.project_id = tasks.project_id + AND project_members.user_id = auth_userid() +) +``` + +**7. Public vs. Private Record Visibility** + +```sql +-- SELECT policy +visibility = 'public' OR owner_id = auth_userid() +``` + +With these policies, when a user executes a query, SQLite Cloud will automatically enforce the defined RLS rules, ensuring data security and compliance. + +### Additional Real-World Examples + +Here are a few more examples to illustrate how you can use RLS policies to solve common security challenges. + +#### 1. Team-Based Access (Multi-Tenancy) + +**Use Case:** A user should only be able to see documents that belong to their organization or team. This is a classic multi-tenancy scenario. + +**Assumptions:** +* Your `documents` table has an `org_id` column. +* The user's access token contains their organization ID in the JSON attributes (e.g., `{"org_id": "acme_corp"}`). + +**RLS Policy (`SELECT`):** +```sql +-- On the 'documents' table +org_id = json_extract(auth_json(), '$.attributes.org_id') +``` + +**Explanation:** +This policy ensures that the `org_id` in the document row must match the `org_id` stored in the authenticated user's token. This effectively isolates data between different organizations. + +--- + +#### 2. Content Publishing Workflow + +**Use Case:** In a simple CMS or blog, any user (even anonymous ones, if applicable) can see articles with a `published` status. However, only the original author can see their own articles when they are in the `draft` status. + +**Assumptions:** +* Your `articles` table has a `status` column (`'draft'` or `'published'`) and an `author_id` column. + +**RLS Policy (`SELECT`):** +```sql +-- On the 'articles' table +status = 'published' OR (status = 'draft' AND author_id = auth_userid()) +``` + +**Explanation:** +This policy uses a boolean `OR` to combine two conditions. A user can see a row if: +1. The article's status is `published`, OR +2. The article's status is `draft` AND the user is the author. + +--- + +#### 3. Making Records Read-Only + +**Use Case:** Once an invoice has been marked as `paid`, it should become immutable. No user should be able to update it. + +**Assumptions:** +* Your `invoices` table has a `status` column (`'pending'`, `'paid'`, etc.). + +**RLS Policy (`UPDATE`):** +```sql +-- On the 'invoices' table +OLD.status <> 'paid' +``` + +**Explanation:** +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. + +### Advanced: RLS and SQLite Sync + +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. + +To accommodate this, SQLite Cloud offers two modes for handling RLS during sync operations, configurable via the `rls_mode` server setting. + +#### Default Mode (`rls_mode = 1`) + +To simplify policy creation for the most common use cases, the default mode does **not** enforce `INSERT` and `UPDATE` policies while applying changes from SQLite Sync. + +Instead, after the sync operation is complete, the `SELECT` policy is used to validate the final state of the row. If the user does not have permission to view the resulting row, the entire transaction is rolled back. This ensures that users cannot introduce changes that they are not allowed to see. + +#### Manual Policy Mode (`rls_mode = 0`) + +For more complex scenarios, such as implementing separate read/write permissions or restricting write access to specific columns, you can set `rls_mode` to `0`. + +In this mode, your `INSERT` and `UPDATE` policies are enforced for every incremental change applied by SQLite Sync. Because of Sync's column-by-column operation, your policies must be written to permit intermediate states. This means the policies must allow `NEW` values for non-primary key columns to be temporarily set to their default values during the sync process. From 65460dd93ec1af9f1bfe2c3851b9c86b1919316b Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 14 Jul 2025 11:12:32 +0200 Subject: [PATCH 132/185] removed readme from build --- README.md => _README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => _README.md (100%) diff --git a/README.md b/_README.md similarity index 100% rename from README.md rename to _README.md From a2e991bc6ecd29064f6858ff7aa7b3a1bc193dbb Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 14 Jul 2025 11:16:00 +0200 Subject: [PATCH 133/185] trigger build --- _README.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename _README.md => README.md (100%) diff --git a/_README.md b/README.md similarity index 100% rename from _README.md rename to README.md From 38ea40a3de1f7b1460355a897f65b5ffe3c28f72 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 14 Jul 2025 11:25:55 +0200 Subject: [PATCH 134/185] trigger build --- sqlite-cloud/platform/_wip-index-with-card.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite-cloud/platform/_wip-index-with-card.mdx b/sqlite-cloud/platform/_wip-index-with-card.mdx index 875df1e..3aba1f5 100644 --- a/sqlite-cloud/platform/_wip-index-with-card.mdx +++ b/sqlite-cloud/platform/_wip-index-with-card.mdx @@ -11,6 +11,8 @@ import IndexPage from "@docs-website-components/Docs/IndexPage.astro" export const introduction = "SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. It has been specifically designed from the ground up to ensure the strong consistency of your data across all nodes in a cluster while simultaneously managing the technical aspects of scaling, security, and data distribution." + + export const sections = [ { icon: "puzzle", From 7d41d138bb3e55ea085370a380332b86edee8650 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Mon, 14 Jul 2025 14:26:10 +0200 Subject: [PATCH 135/185] Update rls.mdx --- sqlite-cloud/platform/rls.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index 8fd6ee6..75bcba3 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -11,7 +11,7 @@ import Callout from "@commons-components/Information/Callout.astro"; 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. -RLS rules only affect users who are authenticated using tokens. Admins, APIKEYs, or other non-token users are not restricted by RLS. +RLS rules only affect users who are authenticated using [Access Tokens](/docs/access-tokens). Admins, APIKEYs, or other non-token users are not restricted by RLS. RLS is a powerful feature for building secure, multi-tenant applications. When combined with [SQLite Sync](https://github.com/sqliteai/sqlite-sync), it enables you to create robust **local-first apps** where user data is stored on the device for offline availability and superior performance. @@ -213,7 +213,7 @@ This policy uses the `OLD` reference to check the value of the `status` column * 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. -To accommodate this, SQLite Cloud offers two modes for handling RLS during sync operations, configurable via the `rls_mode` server setting. +To accommodate this, SQLite Cloud offers two modes for handling RLS during sync operations, configurable via the `rls_mode` server setting using the SQLite Cloud builtin command `SET KEY rls_mode TO `. #### Default Mode (`rls_mode = 1`) From 172d78d1cb39d48c5a91f732ae3bd4e250b4d4da Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Wed, 16 Jul 2025 15:24:50 +0200 Subject: [PATCH 136/185] add offsync doc --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/platform/offsync.mdx | 42 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 sqlite-cloud/platform/offsync.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index de07b69..68e3b77 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -83,6 +83,7 @@ const sidebarNav: SidebarNavStruct = [ type: "inner", level: 0, }, + { title: "Offsync", filePath: "offsync", type: "inner", level: 0 }, { title: "Access Tokens", filePath: "access-tokens", diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx new file mode 100644 index 0000000..f63b6d7 --- /dev/null +++ b/sqlite-cloud/platform/offsync.mdx @@ -0,0 +1,42 @@ +--- +title: Offsync +description: Enable local-first applications with automatic data synchronization between edge devices and SQLite Cloud. +category: platform +status: publish +slug: offsync +--- + +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. + +- **Offline-First by Design**: Applications work seamlessly even when devices are offline. Changes are queued locally and synced automatically when connectivity is restored. +- **CRDT-Based Conflict Resolution**: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without complex merge logic. +- **Seamless Integration**: The sync layer is tightly integrated with SQLite Cloud, enabling secure data sharing across devices, users, and platforms. + +When combined with [Row-Level Security (RLS)](/docs/sqlite-cloud/platform/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. + +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. + + ![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. + + ![Dashboard Offsync Settings Page](@docs-website-assets/introduction/offsync-2.png) + + +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. + + +Once enabled, any changes made to the selected tables via the SQLite Sync extension will be automatically synchronized with your SQLite Cloud database. From 5a4dcac386a9471c47c4f78b6d3eadb62acc09ec Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Wed, 16 Jul 2025 15:31:09 +0200 Subject: [PATCH 137/185] add a link to offsync doc --- sqlite-cloud/platform/rls.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index 75bcba3..b1034e2 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -16,7 +16,7 @@ RLS rules only affect users who are authenticated using [Access Tokens](/docs/ac RLS is a powerful feature for building secure, multi-tenant applications. When combined with [SQLite Sync](https://github.com/sqliteai/sqlite-sync), it enables you to create robust **local-first apps** where user data is stored on the device for offline availability and superior performance. -This architecture simplifies development by allowing your application to interact with a local database while SQLite Cloud 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. +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. ## Policy Enforcement From 2a1ad8ebef045ad2c8e5be1c8ca9183444cf15a6 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Wed, 16 Jul 2025 15:31:25 +0200 Subject: [PATCH 138/185] fix rls link --- sqlite-cloud/platform/offsync.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx index f63b6d7..584a61a 100644 --- a/sqlite-cloud/platform/offsync.mdx +++ b/sqlite-cloud/platform/offsync.mdx @@ -20,7 +20,7 @@ Offsync extends standard SQLite tables with built-in support for offline work an - **CRDT-Based Conflict Resolution**: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without complex merge logic. - **Seamless Integration**: The sync layer is tightly integrated with SQLite Cloud, enabling secure data sharing across devices, users, and platforms. -When combined with [Row-Level Security (RLS)](/docs/sqlite-cloud/platform/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. +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 From 6c7ee4f7c327b326d39583b07308d47a4bececf4 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Wed, 16 Jul 2025 15:43:13 +0200 Subject: [PATCH 139/185] fix: use the correct casing for OffSync --- sqlite-cloud/_nav.ts | 2 +- sqlite-cloud/platform/offsync.mdx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 68e3b77..074c2cc 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -83,7 +83,7 @@ const sidebarNav: SidebarNavStruct = [ type: "inner", level: 0, }, - { title: "Offsync", filePath: "offsync", type: "inner", level: 0 }, + { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, { title: "Access Tokens", filePath: "access-tokens", diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx index 584a61a..2924156 100644 --- a/sqlite-cloud/platform/offsync.mdx +++ b/sqlite-cloud/platform/offsync.mdx @@ -1,5 +1,5 @@ --- -title: Offsync +title: OffSync description: Enable local-first applications with automatic data synchronization between edge devices and SQLite Cloud. category: platform status: publish @@ -8,23 +8,23 @@ slug: offsync 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. +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. +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. +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. - **Offline-First by Design**: Applications work seamlessly even when devices are offline. Changes are queued locally and synced automatically when connectivity is restored. - **CRDT-Based Conflict Resolution**: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without complex merge logic. - **Seamless Integration**: The sync layer is tightly integrated with SQLite Cloud, enabling secure data sharing across devices, users, and platforms. -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. +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 +## 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. 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. @@ -36,7 +36,7 @@ You can enable and manage Offsync for your databases directly from the SQLite Cl ![Dashboard Offsync Settings Page](@docs-website-assets/introduction/offsync-2.png) -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. +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. Once enabled, any changes made to the selected tables via the SQLite Sync extension will be automatically synchronized with your SQLite Cloud database. From 188e71a09dff142255b78799868555c621066264 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Wed, 16 Jul 2025 18:02:22 +0200 Subject: [PATCH 140/185] Update search.yml to use docsearch-action@v6 --- .github/workflows/search.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/search.yml b/.github/workflows/search.yml index 903abdf..2c48cf0 100644 --- a/.github/workflows/search.yml +++ b/.github/workflows/search.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: sqlitecloud/docsearch-action@v5 + - uses: sqlitecloud/docsearch-action@v6 with: project-string: ${{ secrets.PROJECT_STRING }} base-url: ${{ vars.BASE_URL }} From c2f640ebc356cd72bbf2879f2bbcfb152a214f40 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Fri, 18 Jul 2025 14:49:30 +0200 Subject: [PATCH 141/185] fix(access-tokens): example app url --- sqlite-cloud/platform/access-tokens.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index 7ed23c1..3e62528 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -14,7 +14,7 @@ The API Documentation for the Access Tokens API can be found in the **Weblite** ## Example Using SQLite Cloud Access Tokens with Google Login -In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples), we created a simple app to demonstrate how to generate and use Access Tokens. +In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples/tree/main/access-tokens-and-social-login), we created a simple app to demonstrate how to generate and use Access Tokens. We’ll log in with Google, grab a token, and use it to interact with SQLite Cloud Weblite APIs. Here’s how it works. @@ -78,4 +78,4 @@ const res = await fetch("https:///v2/weblite/sql", { ... ``` -The result depends on the [Row Level Security](https://) you enabled for the tables. +The result depends on the [Row Level Security](https://docs.sqlitecloud.io/docs/rls) policies you enabled for the tables. From 6e6c458c8a6d7aa69b634287e34af45c27ea738f Mon Sep 17 00:00:00 2001 From: Marco Bambini Date: Mon, 21 Jul 2025 12:35:24 +0200 Subject: [PATCH 142/185] Updated documentation --- .gitignore | 1 + sqlite-cloud/_nav.ts | 134 ++++++------------ sqlite-cloud/{platform => }/architecture.mdx | 0 .../platform/{vector.mdx => _vector.mdx} | 0 sqlite-cloud/platform/apikey.mdx | 20 +++ sqlite-cloud/platform/extensions.mdx | 9 +- sqlite-cloud/platform/security.mdx | 14 +- .../quick-start-apollo-graphql.mdx | 0 .../{ => quickstart}/quick-start-cdn.mdx | 0 .../{ => quickstart}/quick-start-django.mdx | 0 .../{ => quickstart}/quick-start-flask.mdx | 0 .../{ => quickstart}/quick-start-gin.mdx | 0 .../quick-start-knex.mdx} | 2 +- .../quick-start-laravel.mdx} | 0 .../{ => quickstart}/quick-start-next.mdx | 0 .../{ => quickstart}/quick-start-node.mdx | 0 .../{ => quickstart}/quick-start-prisma.mdx | 0 .../quick-start-react-native.mdx | 0 .../{ => quickstart}/quick-start-react.mdx | 0 .../quick-start-sqlalchemy-orm.mdx | 0 .../quick-start-streamlit.mdx | 0 sqlite-cloud/sqlite-ai/ai-overview.mdx | 37 +++++ .../{platform => sqlite-ai}/mcp-server.mdx | 0 sqlite-cloud/sqlite-ai/sqlite-ai.mdx | 13 ++ sqlite-cloud/sqlite-ai/sqlite-js.mdx | 13 ++ sqlite-cloud/sqlite-ai/sqlite-sync.mdx | 15 ++ sqlite-cloud/sqlite-ai/sqlite-vector.mdx | 13 ++ .../{ => tutorials}/tutorial-geopoly.mdx | 0 28 files changed, 166 insertions(+), 105 deletions(-) create mode 100644 .gitignore rename sqlite-cloud/{platform => }/architecture.mdx (100%) rename sqlite-cloud/platform/{vector.mdx => _vector.mdx} (100%) create mode 100644 sqlite-cloud/platform/apikey.mdx rename sqlite-cloud/{ => quickstart}/quick-start-apollo-graphql.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-cdn.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-django.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-flask.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-gin.mdx (100%) rename sqlite-cloud/{knex-integration.mdx => quickstart/quick-start-knex.mdx} (99%) rename sqlite-cloud/{quick-start-php-laravel.mdx => quickstart/quick-start-laravel.mdx} (100%) rename sqlite-cloud/{ => quickstart}/quick-start-next.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-node.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-prisma.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-react-native.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-react.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-sqlalchemy-orm.mdx (100%) rename sqlite-cloud/{ => quickstart}/quick-start-streamlit.mdx (100%) create mode 100644 sqlite-cloud/sqlite-ai/ai-overview.mdx rename sqlite-cloud/{platform => sqlite-ai}/mcp-server.mdx (100%) create mode 100644 sqlite-cloud/sqlite-ai/sqlite-ai.mdx create mode 100644 sqlite-cloud/sqlite-ai/sqlite-js.mdx create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync.mdx create mode 100644 sqlite-cloud/sqlite-ai/sqlite-vector.mdx rename sqlite-cloud/{ => tutorials}/tutorial-geopoly.mdx (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 074c2cc..f6a267d 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -2,101 +2,56 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, - { - title: "Introduction", - type: "secondary", - icon: "docs-star", - }, + // ### AI ### + { title: "AI", type: "secondary", icon: "docs-star",}, + { title: "Overview", filePath: "ai-overview", type: "inner", level: 0 }, + { title: "SQLite-AI", filePath: "sqlite-ai", type: "inner", level: 0 }, + { title: "SQLite-JS", filePath: "sqlite-js", type: "inner", level: 0 }, + { title: "SQLite-Sync", filePath: "sqlite-sync", type: "inner", level: 0 }, + { title: "SQLite-Vector", filePath: "sqlite-vector", type: "inner", level: 0 }, + { title: "MCP (Model Context Protocol)", filePath: "mcp-server", type: "inner", level: 0 }, + + // ### CLOUD ### + { title: "Cloud", type: "secondary", icon: "docs-star",}, { title: "Overview", filePath: "overview", type: "inner", level: 0 }, + { title: "Scaling", filePath: "architecture", type: "inner", level: 0 }, { title: "Getting Started", type: "inner", level: 0 }, - { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, - { - title: "Creating a database", - filePath: "create-database", - type: "inner", - level: 1, - }, - { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { - title: "React Native", - filePath: "quick-start-react-native", - type: "inner", - level: 1, - }, - { - title: "Apollo / GraphQL", - filePath: "quick-start-apollo-graphql", - type: "inner", - level: 1, - }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, - { - title: "SQLAlchemy", - filePath: "quick-start-sqlalchemy-orm", - type: "inner", - level: 1, - }, - { - title: "Streamlit", - filePath: "quick-start-streamlit", - type: "inner", - level: 1, - }, - { - title: "PHP / Laravel", - filePath: "quick-start-php-laravel", - type: "inner", - level: 1, - }, - { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, - { title: "Tutorials", type: "inner", level: 0 }, - { title: "Geopoly", filePath: "tutorial-geopoly", type: "inner", level: 1 }, - { title: "Integrations", type: "inner", level: 0 }, - { title: "Knex.js", filePath: "knex-integration", type: "inner", level: 1 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, + { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, + { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, + { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Knex.js", filePath: "quick-start-knex", type: "inner", level: 1 }, + // ### PLATFORM ### { title: "Platform", type: "secondary", icon: "docs-plat" }, - { - title: "Edge Functions", - filePath: "edge-functions", - type: "inner", - level: 0, - }, - { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, - { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, - { title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Scaling", type: "inner", filePath: "architecture", level: 0 }, - { - title: "Security and Access Control", - filePath: "security", - type: "inner", - level: 0, - }, - { - title: "Row-Level Security", - filePath: "rls", - type: "inner", - level: 0, - }, - { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, - { - title: "Access Tokens", - filePath: "access-tokens", - type: "inner", - level: 0, - }, - { title: "Backups", filePath: "backups", type: "inner", level: 0 }, - { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, - { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, - { title: "Weblite", filePath: "weblite", type: "inner", level: 0 }, - { title: "AI - Model Context Protocol (MCP)", filePath: "mcp-server", type: "inner", level: 0 }, + { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, + { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, + { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + //{ title: "Vector", filePath: "vector", type: "inner", level: 0 }, + { title: "Users and Roles", filePath: "security", type: "inner", level: 0 }, + { title: "API Keys", filePath: "apikey", type: "inner", level: 0 }, + { title: "Row-Level Security", filePath: "rls", type: "inner", level: 0}, + { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, + { title: "Access Tokens", filePath: "access-tokens", type: "inner", level: 0 }, + { title: "Backups", filePath: "backups", type: "inner", level: 0 }, + { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, - { title: "SDKs", type: "secondary", icon: "docs-sdk" }, + // ### CLOUD SDK ### + { title: "Cloud SDK", type: "secondary", icon: "docs-sdk" }, { title: "C/C++", type: "inner", level: 0 }, { title: "Introduction", @@ -578,6 +533,7 @@ const sidebarNav: SidebarNavStruct = [ level: 1, }, + // ### REFERENCE ### { title: "Reference", type: "secondary", icon: "docs-ref" }, { title: "Server-side Commands", type: "inner", level: 0 }, { diff --git a/sqlite-cloud/platform/architecture.mdx b/sqlite-cloud/architecture.mdx similarity index 100% rename from sqlite-cloud/platform/architecture.mdx rename to sqlite-cloud/architecture.mdx diff --git a/sqlite-cloud/platform/vector.mdx b/sqlite-cloud/platform/_vector.mdx similarity index 100% rename from sqlite-cloud/platform/vector.mdx rename to sqlite-cloud/platform/_vector.mdx diff --git a/sqlite-cloud/platform/apikey.mdx b/sqlite-cloud/platform/apikey.mdx new file mode 100644 index 0000000..ee08944 --- /dev/null +++ b/sqlite-cloud/platform/apikey.mdx @@ -0,0 +1,20 @@ +--- +title: Security and Access Control +description: SQLite Cloud provides secure access to resources through role-based authorization, which ensures user isolation and enhances security and manageability. +category: platform +status: publish +slug: apikey +--- + +## API KEYs + +API KEYs can be used as an alternative authentication mechanism. +Authentication through API keys ensures the same privileges as the user to which they are associated. +API KEYs are recommended for all server-to-server authentication cases and are necessary for using the REST APIs and the SDKs that uses the WebSocket APIs. + +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. +![Dashboard List APIKEY](@docs-website-assets/introduction/dashboard_list_apikey.png) diff --git a/sqlite-cloud/platform/extensions.mdx b/sqlite-cloud/platform/extensions.mdx index 3b9931d..6a958ea 100644 --- a/sqlite-cloud/platform/extensions.mdx +++ b/sqlite-cloud/platform/extensions.mdx @@ -6,14 +6,17 @@ status: publish slug: extensions --- -SQLite Cloud comes with the following pre-installed SQLite extensions. These extensions are available for use in your SQLite Cloud databases. +SQLite Cloud comes with the following pre-installed SQLite extensions. +These extensions are available for use in your SQLite Cloud databases. ## Extensions +- **[SQLite-Vector](sqlite-vector)**: High performance vector storage extension for similarity search. +- **[SQLite-Sync](sqlite-sync)**: Local-first extension for true local-first data synchronization for your applications. +- **[SQLite-JS](sqlite-js)**: Enables JavaScript integration in SQLite for executing server-side logic. - **[Full-text Search 5](https://www.sqlite.org/fts5.html)**: Full-text search engine that allows you to search for text in a database. - **[JSON1](https://www.sqlite.org/json1.html)**: Allows you to easily store, query, and manipulate JSON data. - **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Mathematical functions. - **[RTree](https://www.sqlite.org/rtree.html)**: R-Tree index for storing and querying spatial data. -- **[Geopoly](https://www.sqlite.org/geopoly.html)**: Functions for working with geospatial data. -- **[sqlite-vec](/docs/vector)**: Vector storage extension for similarity search. +- **[Geopoly](https://www.sqlite.org/geopoly.html)**: A set of functions for working with geospatial data. For a complete guide, see the [comprehensive tutorial here](tutorial-geopoly). In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by [adding to this issue](https://github.com/sqlitecloud/docs/issues/34). \ No newline at end of file diff --git a/sqlite-cloud/platform/security.mdx b/sqlite-cloud/platform/security.mdx index 5677f15..3cd63e5 100644 --- a/sqlite-cloud/platform/security.mdx +++ b/sqlite-cloud/platform/security.mdx @@ -148,7 +148,7 @@ A role can contains any combination of privileges. -----------------| ``` - +{/* ## IP Restrictions The IP Restrictions panel enables the restriction of access for a role or user by allowing only specific IP addresses or ranges in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) (for example 10.10.10.0/24). Both IPv4 and IPv6 addresses are supported. @@ -159,14 +159,4 @@ To add a new IP restriction to a user or role, click on the **Add IP** button. The IP Restrictions table will display all current IP restrictions for the selected user or role. ![Dashboard List IP Restrictions](@docs-website-assets/introduction/dashboard_list_ip.png) - -## API KEYs - -API KEYs can be used as an alternative authentication mechanism. Authentication through API keys ensures the same privileges as the user to which they are associated. API KEYs are recommended for all server-to-server authentication cases and are necessary for using the REST APIs and the SDKs that uses the WebSocket APIs. - -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. -![Dashboard List APIKEY](@docs-website-assets/introduction/dashboard_list_apikey.png) +*/} \ No newline at end of file diff --git a/sqlite-cloud/quick-start-apollo-graphql.mdx b/sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx similarity index 100% rename from sqlite-cloud/quick-start-apollo-graphql.mdx rename to sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx diff --git a/sqlite-cloud/quick-start-cdn.mdx b/sqlite-cloud/quickstart/quick-start-cdn.mdx similarity index 100% rename from sqlite-cloud/quick-start-cdn.mdx rename to sqlite-cloud/quickstart/quick-start-cdn.mdx diff --git a/sqlite-cloud/quick-start-django.mdx b/sqlite-cloud/quickstart/quick-start-django.mdx similarity index 100% rename from sqlite-cloud/quick-start-django.mdx rename to sqlite-cloud/quickstart/quick-start-django.mdx diff --git a/sqlite-cloud/quick-start-flask.mdx b/sqlite-cloud/quickstart/quick-start-flask.mdx similarity index 100% rename from sqlite-cloud/quick-start-flask.mdx rename to sqlite-cloud/quickstart/quick-start-flask.mdx diff --git a/sqlite-cloud/quick-start-gin.mdx b/sqlite-cloud/quickstart/quick-start-gin.mdx similarity index 100% rename from sqlite-cloud/quick-start-gin.mdx rename to sqlite-cloud/quickstart/quick-start-gin.mdx diff --git a/sqlite-cloud/knex-integration.mdx b/sqlite-cloud/quickstart/quick-start-knex.mdx similarity index 99% rename from sqlite-cloud/knex-integration.mdx rename to sqlite-cloud/quickstart/quick-start-knex.mdx index 8407ed1..d421d4d 100644 --- a/sqlite-cloud/knex-integration.mdx +++ b/sqlite-cloud/quickstart/quick-start-knex.mdx @@ -3,7 +3,7 @@ title: Knex.js Integration description: Integrate SQLite Cloud with Knex.js, a popular SQL query builder. category: getting-started status: publish -slug: knex-integration +slug: quick-start-knex --- In this tutorial, we'll show you how to connect your TypeScript application to a SQLite Cloud database using the popular SQL builder, [Knex.js](https://knexjs.org/). diff --git a/sqlite-cloud/quick-start-php-laravel.mdx b/sqlite-cloud/quickstart/quick-start-laravel.mdx similarity index 100% rename from sqlite-cloud/quick-start-php-laravel.mdx rename to sqlite-cloud/quickstart/quick-start-laravel.mdx diff --git a/sqlite-cloud/quick-start-next.mdx b/sqlite-cloud/quickstart/quick-start-next.mdx similarity index 100% rename from sqlite-cloud/quick-start-next.mdx rename to sqlite-cloud/quickstart/quick-start-next.mdx diff --git a/sqlite-cloud/quick-start-node.mdx b/sqlite-cloud/quickstart/quick-start-node.mdx similarity index 100% rename from sqlite-cloud/quick-start-node.mdx rename to sqlite-cloud/quickstart/quick-start-node.mdx diff --git a/sqlite-cloud/quick-start-prisma.mdx b/sqlite-cloud/quickstart/quick-start-prisma.mdx similarity index 100% rename from sqlite-cloud/quick-start-prisma.mdx rename to sqlite-cloud/quickstart/quick-start-prisma.mdx diff --git a/sqlite-cloud/quick-start-react-native.mdx b/sqlite-cloud/quickstart/quick-start-react-native.mdx similarity index 100% rename from sqlite-cloud/quick-start-react-native.mdx rename to sqlite-cloud/quickstart/quick-start-react-native.mdx diff --git a/sqlite-cloud/quick-start-react.mdx b/sqlite-cloud/quickstart/quick-start-react.mdx similarity index 100% rename from sqlite-cloud/quick-start-react.mdx rename to sqlite-cloud/quickstart/quick-start-react.mdx diff --git a/sqlite-cloud/quick-start-sqlalchemy-orm.mdx b/sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx similarity index 100% rename from sqlite-cloud/quick-start-sqlalchemy-orm.mdx rename to sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx diff --git a/sqlite-cloud/quick-start-streamlit.mdx b/sqlite-cloud/quickstart/quick-start-streamlit.mdx similarity index 100% rename from sqlite-cloud/quick-start-streamlit.mdx rename to sqlite-cloud/quickstart/quick-start-streamlit.mdx diff --git a/sqlite-cloud/sqlite-ai/ai-overview.mdx b/sqlite-cloud/sqlite-ai/ai-overview.mdx new file mode 100644 index 0000000..4bd7530 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/ai-overview.mdx @@ -0,0 +1,37 @@ +--- +title: Getting Started with SQLite AI +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: getting-started +status: publish +slug: ai-overview +--- + +## Overview + +**SQLite AI** is an advanced extension of SQLite designed to bring AI capabilities directly to the edge. It transforms the world’s most deployed database into a powerful, intelligent local database engine capable of powering modern, AI-driven applications, from mobile apps to embedded systems, IoT devices, and robotics. + +At the core of the project is a belief that **AI should run where the data is** — locally, privately, and efficiently — without always relying on the cloud. + +### Key Extensions + +SQLite AI is built around several modular extensions: + +1. **SQLite-AI** + Integrates on-device AI capabilities (e.g., LLM inference, audio transcription with Whisper) directly into SQLite using extensions that wrap C-based AI libraries such as `llama.cpp`, `whisper.cpp`, and more. + +2. **SQLite-Vector** + Adds native vector search to SQLite using optimized in-database structures and distance functions (L2, cosine, dot, etc.), with support for multiple vector formats (Float32, Int8, etc.). Ideal for on-device semantic search and AI retrieval. + +3. **SQLite-Sync** + A local-first sync layer that keeps SQLite databases synchronized across devices and users, with support for CRDTs, delta-based replication, and efficient cloud coordination. + +4. **SQLite-JS** + Embed JavaScript directly into SQLite using a lightweight interpreter (e.g., QuickJS), allowing developers to define SQLite functions and logic in JavaScript for increased flexibility and expressiveness. + + +### Features + +* **Works offline-first**: No need for a server to run advanced queries or AI models. +* **Cross-platform**: Runs on iOS, Android, Windows, Linux, macOS, and WebAssembly. +* **Minimal footprint**: Optimized for constrained devices. +* **Modular and open**: Built in C with clean, embeddable APIs and no heavy dependencies. diff --git a/sqlite-cloud/platform/mcp-server.mdx b/sqlite-cloud/sqlite-ai/mcp-server.mdx similarity index 100% rename from sqlite-cloud/platform/mcp-server.mdx rename to sqlite-cloud/sqlite-ai/mcp-server.mdx diff --git a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx new file mode 100644 index 0000000..7d43c74 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx @@ -0,0 +1,13 @@ +--- +title: SQLite-AI +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: platform +status: publish +slug: sqlite-ai +--- + +[SQLite-AI](https://website-stage.sqlitecloud.io/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. + +With a simple SQL interface, you can chat with a model, stream tokens in real time, generate high-quality embeddings, or transcribe and translate audio using Whisper. Multimodal features allow image processing and embedding, making SQLite-AI a versatile foundation for modern AI applications. + +**SQLite-AI** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-ai). \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-js.mdx b/sqlite-cloud/sqlite-ai/sqlite-js.mdx new file mode 100644 index 0000000..0456e2c --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-js.mdx @@ -0,0 +1,13 @@ +--- +title: SQLite-JS +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: platform +status: publish +slug: sqlite-js +--- + +[SQLite-JS](https://website-stage.sqlitecloud.io/sqlite-js) is a powerful extension that lets you write custom cross-platform logic directly in your SQLite database using JavaScript. With support for scalar, aggregate, window functions, and collation sequences, you can express complex operations with ease, all using familiar SQL syntax. + +By integrating SQLite-JS with [SQLite-Sync](sqlite-sync), your user-defined JavaScript functions are automatically synchronized across all clients connected to your cluster, keeping logic consistent everywhere, even offline, for a truly consistent offline-first server-side logic distribution. + +**SQLite-JS** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-js). \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync.mdx b/sqlite-cloud/sqlite-ai/sqlite-sync.mdx new file mode 100644 index 0000000..5815c48 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync.mdx @@ -0,0 +1,15 @@ +--- +title: SQLite-Sync +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: platform +status: publish +slug: sqlite-sync +--- + +[SQLite-Sync](https://website-stage.sqlitecloud.io/sqlite-sync) is a cross-platform extension that adds built-in offline support and automatic synchronization to standard SQLite databases, enabling a **true local-first experience with zero latency**. Applications can operate fully offline, with each device maintaining its own copy of the database + +When reconnected, all changes are seamlessly synchronized across devices. Developers can continue using the familiar simplicity and performance of SQLite while easily building distributed, collaborative applications without complex infrastructure. + +SQLite Sync is powered by CRDTs (Conflict-free Replicated Data Types), a class of algorithms designed for real-time collaboration and distributed systems. CRDTs ensure that changes made on different devices are merged automatically and without conflicts, even when made offline. This means no data loss, no overwrites, and no need for manual conflict resolution. Whether it's a multi-user app or a fleet of devices operating in the field, SQLite Sync keeps everything consistent and in sync automatically. + +**SQLite-Sync** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-sync). \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-vector.mdx b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx new file mode 100644 index 0000000..4a0fd31 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx @@ -0,0 +1,13 @@ +--- +title: SQLite-Vector +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: platform +status: publish +slug: sqlite-vector +--- + +[SQLite-Vector](https://website-stage.sqlitecloud.io/sqlite-vector) is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities directly into your embedded database + +Whether you're dealing with **millions of high-dimensional vectors** or operating on resource-constrained edge devices, SQLite-Vector delivers **lightning-fast performance** with a **tiny memory footprint**. + +**SQLite-Vector** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-vector). \ No newline at end of file diff --git a/sqlite-cloud/tutorial-geopoly.mdx b/sqlite-cloud/tutorials/tutorial-geopoly.mdx similarity index 100% rename from sqlite-cloud/tutorial-geopoly.mdx rename to sqlite-cloud/tutorials/tutorial-geopoly.mdx From 4624f3ecedc0a28d749be132bd68540736f21e53 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 23 Jul 2025 10:23:10 +0200 Subject: [PATCH 143/185] changed sqliteclodu.io to sqlite.ai --- sqlite-cloud/knex-integration.mdx | 2 +- sqlite-cloud/platform/mcp-server.mdx | 2 +- sqlite-cloud/sdks/go/introduction.mdx | 2 +- sqlite-cloud/sdks/js/introduction.mdx | 4 ++-- sqlite-cloud/sdks/python/introduction.mdx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sqlite-cloud/knex-integration.mdx b/sqlite-cloud/knex-integration.mdx index 8407ed1..23568db 100644 --- a/sqlite-cloud/knex-integration.mdx +++ b/sqlite-cloud/knex-integration.mdx @@ -13,7 +13,7 @@ In this tutorial, we'll show you how to connect your TypeScript application to a **Prerequisites** - Node.js and npm installed on your system -- A SQLite Cloud account (you can sign up for a free account [here](https://sqlitecloud.io/register)) +- A SQLite Cloud account (you can sign up for a free account [here](https://dashboard.sqlitecloud.io/auth/sign-in)) 1. **How to connect** diff --git a/sqlite-cloud/platform/mcp-server.mdx b/sqlite-cloud/platform/mcp-server.mdx index 34818b7..e36c5f1 100644 --- a/sqlite-cloud/platform/mcp-server.mdx +++ b/sqlite-cloud/platform/mcp-server.mdx @@ -19,7 +19,7 @@ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) ## Getting Started -To use the MCP Server, create a [free account on SQLite Cloud](https://sqlitecloud.io) and obtain your **Connection String**. +To use the MCP Server, create a [free account on SQLite Cloud](https://dashboard.sqlitecloud.io/auth/sign-in) and obtain your **Connection String**. ### Requirements diff --git a/sqlite-cloud/sdks/go/introduction.mdx b/sqlite-cloud/sdks/go/introduction.mdx index 0171f51..c3f719c 100644 --- a/sqlite-cloud/sdks/go/introduction.mdx +++ b/sqlite-cloud/sdks/go/introduction.mdx @@ -91,5 +91,5 @@ The complete documentation is available at: [https://pkg.go.dev/github.com/sqlit [![GitHub Tag](https://img.shields.io/github/v/tag/sqlitecloud/sqlitecloud-go?label=version&link=https%3A%2F%2Fpkg.go.dev%2Fgithub.com%2Fsqlitecloud%2Fsqlitecloud-go)](https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go) [![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/sqlitecloud/sqlitecloud-go?link=https%3A%2F%2Fpkg.go.dev%2Fgithub.com%2Fsqlitecloud%2Fsqlitecloud-go)](https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go) -[SQLite Cloud](https://sqlitecloud.io) for Go is a powerful package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Go applications, making it easier than ever to work with SQLite Cloud. In addition to the standard SQLite statements, several other [commands](https://docs.sqlitecloud.io/docs/commands) are supported. +[SQLite Cloud](https://sqlite.ai) for Go is a powerful package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Go applications, making it easier than ever to work with SQLite Cloud. In addition to the standard SQLite statements, several other [commands](https://docs.sqlitecloud.io/docs/commands) are supported. diff --git a/sqlite-cloud/sdks/js/introduction.mdx b/sqlite-cloud/sdks/js/introduction.mdx index 3f6b7a4..a763b04 100644 --- a/sqlite-cloud/sdks/js/introduction.mdx +++ b/sqlite-cloud/sdks/js/introduction.mdx @@ -34,14 +34,14 @@ let results = await database.sql`SELECT * FROM tracks WHERE name = ${name}` Use [Database.sql](/docs/sqlite-cloud/sdks/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. -We aim for full compatibility with the established [sqlite3 API](https://www.npmjs.com/package/sqlite3), with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlitecloud.io) while continuing to use your existing codebase. +We aim for full compatibility with the established [sqlite3 API](https://www.npmjs.com/package/sqlite3), with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlite.ai) while continuing to use your existing codebase. The package is developed entirely in TypeScript and is fully compatible with JavaScript. It doesn't require any native libraries. This makes it a straightforward and effective tool for managing cloud-based databases in a familiar SQLite environment. ## More How do I deploy SQLite in the cloud? -[https://sqlitecloud.io](https://sqlitecloud.io) +[https://sqlite.ai](https://sqlite.ai) How do I connect SQLite cloud with Javascript? [https://sqlitecloud.github.io/sqlitecloud-js/](https://sqlitecloud.github.io/sqlitecloud-js/) diff --git a/sqlite-cloud/sdks/python/introduction.mdx b/sqlite-cloud/sdks/python/introduction.mdx index ac362cd..7e8cb9b 100644 --- a/sqlite-cloud/sdks/python/introduction.mdx +++ b/sqlite-cloud/sdks/python/introduction.mdx @@ -15,7 +15,7 @@ pip install sqlitecloud ## Basic Usage -We aim for full compatibility with the established [sqlite3 API](https://docs.python.org/3/library/sqlite3.html), with the primary distinction being that our driver connects to SQLite Cloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlitecloud.io) while continuing to use your existing codebase. +We aim for full compatibility with the established [sqlite3 API](https://docs.python.org/3/library/sqlite3.html), with the primary distinction being that our driver connects to SQLite Cloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlite.ai) while continuing to use your existing codebase. ```python import sqlitecloud From a1940f3d6c845f2610c78a7761ca527afd048fd8 Mon Sep 17 00:00:00 2001 From: Marco Bambini Date: Sun, 27 Jul 2025 10:43:01 +0200 Subject: [PATCH 144/185] Update pub-sub.mdx --- sqlite-cloud/platform/pub-sub.mdx | 268 ++++++++++++++++++++---------- 1 file changed, 182 insertions(+), 86 deletions(-) diff --git a/sqlite-cloud/platform/pub-sub.mdx b/sqlite-cloud/platform/pub-sub.mdx index 4ab5982..73ebad9 100644 --- a/sqlite-cloud/platform/pub-sub.mdx +++ b/sqlite-cloud/platform/pub-sub.mdx @@ -6,141 +6,237 @@ status: publish slug: pub-sub --- -Pub/Sub is a messaging pattern that allows multiple applications to communicate with each other asynchronously. In the context of **SQLiteCloud**, Pub/Sub can be used to provide real-time updates and notifications to subscribed applications whenever data changes in the database or it can be used to send payloads (messages) to anyone subscribed to a channel. Here's how it works: +# SQLiteCloud Pub/Sub System -**Publishers:** Publishers are responsible for sending messages or notifications to the system whenever a change occurs in the database. Publishers can be any application that has write access to the database, including web servers, mobile apps, or background processes. A Publisher can also be anyone who NOTIFY a payload to a specific channel (without any write database operation). +**Publish/Subscribe (Pub/Sub)** is a messaging pattern that enables asynchronous communication between multiple applications. In the context of **SQLiteCloud**, Pub/Sub provides a robust way to deliver real-time updates or custom messages to subscribed clients when data changes or explicit notifications are issued. -**Subscribers:** Subscribers are applications that want to receive updates whenever a change occurs in the database or whenever someone send a message to a specific channel. +This feature is particularly useful for building reactive applications, synchronizing distributed systems, and enabling event-driven architectures around your SQLite databases. -**Channels:** Channels are messaging patterns through which messages are sent and received. Publishers send messages to specific channel, and subscribers can subscribe to one or more channel to receive notifications. A channel can be a database table or a unique name not bound to any database entity. +--- + +## Core Concepts + +### **Publishers** + +Publishers are entities that send messages or notifications. In **SQLiteCloud**, a publisher can: + +* Modify a database (triggering automatic Pub/Sub events on commit). +* Explicitly send a message using the `NOTIFY` command, even without making changes to the database. + +Any client with write access—such as a web server, mobile app, or background process—can act as a publisher. + +### **Subscribers** + +Subscribers are clients that listen for messages or data change events. They can subscribe to: + +* A **channel** representing a database table (to receive change events). +* A **named message channel** (for general-purpose messages). + +Subscribers will receive all messages published on the channels they subscribe to. + +### **Channels** + +Channels are the communication endpoints used for Pub/Sub messaging. A channel can be: + +* A **database table name**, used to deliver change notifications. +* A **custom channel name**, used to send arbitrary messages. -Here are some of the capabilities that Pub/Sub provides for a database management system: +Channels are **not bound** to any database entity unless explicitly tied to a table. -* Real-time updates: With Pub/Sub, subscribers can receive real-time updates whenever data changes in the database. This can be useful for applications that need to display real-time information to users, such as stock tickers or social media feeds. +--- + +## Benefits of Pub/Sub in SQLiteCloud -* Scalability: Pub/Sub provides a scalable solution for database notifications, allowing multiple subscribers to receive updates without impacting database performance. +* **Real-time Updates** + Instantly notify subscribers when data changes. Useful for dashboards, live feeds, or collaborative apps. -* Customizable filtering: Pub/Sub allows subscribers to customize the types of messages they receive by filtering on specific topics or keywords. This can help reduce network traffic and improve application performance. +* **Scalability** + One publisher can broadcast to many subscribers with minimal overhead on the database. -* Fault tolerance: Pub/Sub systems are designed to be fault-tolerant, ensuring that messages are not lost even if a subscriber or publisher goes offline. +* **Message Filtering** + Subscribers can choose specific channels, reducing unnecessary data traffic. -Overall, Pub/Sub provides a powerful messaging system for database management systems, enabling real-time updates and notifications for subscribed applications while maintaining scalability, reliability, and performance. +* **Fault Tolerance** + Notifications are delivered reliably. If a subscriber or publisher disconnects, the system continues to function without losing messages. + +--- -## Pub/Sub Payload Format +## Payload Format -JSON is used to deliver payload to all listening clients. JSON format depends on the operation type. In case of database tables, notifications occur on COMMIT so the same JSON can collect more changes related to that table. **SQLite Cloud** guarantees **one JSON per channel**. +All Pub/Sub messages in **SQLiteCloud** are delivered as **JSON** objects. The structure of the payload depends on the type of event: + +### 1. **NOTIFY Message Payload** + +Sent explicitly by clients using the `NOTIFY` command. -**1. NOTIFY payload** ```json { - sender: "UUID", - channel: "name", - type: "MESSAGE", - payload: "Message content here" // payload is optional + "sender": "UUID", + "channel": "name", + "channel_type": "MESSAGE", + "payload": "Message content here" } ``` +* **sender**: UUID of the client that sent the message. +* **channel**: Target channel name. +* **channel\_type**: Always `"MESSAGE"` for this type. +* **payload**: Optional message content. + +--- + +### 2. **Database Table Change Payload** + +Generated automatically when a transaction modifies a subscribed table. Triggered at **COMMIT** time and may include multiple row operations. -**2. Multiple TABLE modification payload** ```json { - sender: "UUID", - channel: "tablename", - type: "TABLE", - pk: ["id", "col1"], // array of primary key name(s) - payload: [ // array of operations that affect table name - { - type: "INSERT", - id: 12, - col1: "value1", - col2: 3.14 - }, - { - type: "DELETE", - pv: [13], // primary key value (s) in the same order as the pk array - }, - { - type: "UPDATE", - id: 15, // new value - col1: "newvalue", - col2: 0.0, - // if primary key is updated during this update then add it to: - // UPDATE TABLE SET col1='newvalue', col2=0.0, id = 15 WHERE id=14 - pv: [14] // primary key value (s) set prior to this UPDATE operation - } - ] + "sender": "UUID", + "channel": "tablename", + "channel_type": "TABLE", + "sqlite_pk_name": ["id", "col1"], + "payload": [ + { + "sqlite_type": "INSERT", + "id": 12, + "col1": "value1", + "col2": 3.14 + }, + { + "sqlite_type": "DELETE", + "sqlite_pk_value": [13] + }, + { + "sqlite_type": "UPDATE", + "id": 15, + "col1": "newvalue", + "col2": 0.0, + "sqlite_pk_value": [14] + } + ] } ``` -**Details:** +#### Field Descriptions: -* **sender**: is the UUID of the client who sent the NOTIFY event or who initiated the WRITE operation that triggers the notification. It is common for a client that executes **NOTIFY** to be listening on the same notification channel itself. In that case it will get back a notification event, just like all the other listening sessions. Depending on the application logic, this could result in useless work, for example, reading a database table to find the same updates that that session just wrote out. It is possible to avoid such extra work by noticing whether the notifying **UUID** (supplied in the notification event message) is the same as one's **UUID** (available from SDK). When they are the same, the notification event is one's own work bouncing back, and can be ignored. If **UUID** is 0 it means that server sent that payload. -* **channel**: this field represents the channel/table affected. -* **type**: determine the type of operation, it can be: MESSAGE, TABLE, INSERT, UPDATE, or DELETE (more to come). -* **pk/pv**: these fields represent the primary key name(s) and value(s) affected by this table operation. -* **payload**: TODO +* **sender**: UUID of the client initiating the change, or `0` if triggered by the server. +* **channel**: Table name where the change occurred. +* **channel\_type**: `"TABLE"`. +* **sqlite\_pk\_name**: Array of primary key column names for the table. +* **payload**: Array of individual row operations. -**More SQL examples:** -``` + * **sqlite\_type**: `"INSERT"`, `"UPDATE"`, or `"DELETE"`. + * **sqlite\_pk\_value**: Previous primary key values (used in `DELETE` or `UPDATE`). + * Other keys represent column values (for `INSERT` and `UPDATE`). + +> **Tip:** If a client is subscribed to a channel and also publishes to it, it will receive its own notifications. Use the **sender UUID** to filter out self-generated events if needed. + +--- + +## Example SQL Usage + +```sql > USE DATABASE test.sqlite OK > GET SQL foo -CREATE TABLE "foo" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "col1" TEXT, "col2" TEXT) +CREATE TABLE "foo" ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT, + "col1" TEXT, + "col2" TEXT +) > LISTEN TABLE foo OK ``` -**3. DELETE FROM foo WHERE id=14;** +--- + +## Example Event Payloads + +### DELETE + +```sql +DELETE FROM foo WHERE id=14; +``` + ```json { - "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", - "channel": "foo", - "type": "TABLE", - "pk": ["id"], - "payload": [{ - "type": "DELETE", - "pv": [14] - }] + "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", + "channel": "foo", + "channel_type": "TABLE", + "sqlite_pk_name": ["id"], + "payload": [{ + "sqlite_type": "DELETE", + "sqlite_pk_value": [14] + }] } ``` -**4. INSERT INTO foo(col1, col2) VALUES ('test100', 'test101');** +--- + +### INSERT + +```sql +INSERT INTO foo(col1, col2) VALUES ('test100', 'test101'); +``` + ```json { - "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", - "channel": "foo", - "type": "TABLE", - "pk": ["id"], - "payload": [{ - "type": "INSERT", - "id": 15, - "col1": "test100", - "col2": "test101" - }] + "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", + "channel": "foo", + "channel_type": "TABLE", + "sqlite_pk_name": ["id"], + "payload": [{ + "sqlite_type": "INSERT", + "id": 15, + "col1": "test100", + "col2": "test101" + }] } ``` -**5. UPDATE foo SET id=14,col1='test200' WHERE id=15;** +--- + +### UPDATE (Primary Key Changed) + +```sql +UPDATE foo SET id=14, col1='test200' WHERE id=15; +``` + ```json { - "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", - "channel": "foo", - "type": "TABLE", - "pk": ["id"], - "payload": [{ - "type": "DELETE", - "pv": [15] - }, { - "type": "INSERT", - "id": 14, - "col1": "test200", - "col2": "test101" - }] + "sender": "b7a92805-ef82-4ad1-8c2f-92da6df6b1d5", + "channel": "foo", + "channel_type": "TABLE", + "sqlite_pk_name": ["id"], + "payload": [ + { + "sqlite_type": "DELETE", + "sqlite_pk_value": [15] + }, + { + "sqlite_type": "INSERT", + "id": 14, + "col1": "test200", + "col2": "test101" + } + ] } ``` +--- + +## Summary + +SQLiteCloud's Pub/Sub system enables: + +* Real-time data sync across applications. +* Lightweight messaging between distributed components. +* Fine-grained, reliable notifications with minimal overhead. + +By leveraging Pub/Sub, developers can build responsive, event-driven applications that scale seamlessly and remain in sync with the database state. + ## Client Library Examples ```javascript From b50a50c2bced4aa5282043b482a1f8c31a76a7b0 Mon Sep 17 00:00:00 2001 From: Marco Bambini Date: Mon, 28 Jul 2025 09:21:33 +0200 Subject: [PATCH 145/185] Update webhooks.mdx --- sqlite-cloud/platform/webhooks.mdx | 36 +++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index f805bd3..3eb6e0d 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -6,10 +6,40 @@ status: publish slug: webhooks --- -Webhooks in SQLite Cloud are a powerful way to receive and send event-based notifications. +**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. + +## Real-Time Notifications for Database Writes + +Use the **Webhooks panel** to effortlessly create real-time notifications for write operations—such as inserts, updates, or deletes—within your SQLite Cloud database. + +For example, you can configure SQLite Cloud to notify a [webhook.site](https://webhook.site) endpoint every time a write operation occurs on the `albums` table of the `chinook.sqlite` database. + +![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create.png) ## Change Data Capture -With change data webhooks, you can send notifications from SQLite Cloud to any HTTP endpoint when an insert, update or delete operation occurs on a specified database and/or table. The webhook payload includes the database name, table name, and the row data that was changed. + +Change Data Webhooks let you send structured HTTP requests to any external service whenever a row in a specific database and/or table is modified. These webhooks include: + +* **Database name** +* **Table name** +* **Operation type** (insert, update, delete) +* **Changed row data** + +This enables seamless integration with logging systems, monitoring dashboards, or external APIs that react to database activity. + +Upon creation, each webhook is assigned a **secret key** used to verify the authenticity of incoming requests. + +![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create2.png) + +You can also manage and review all active webhooks from your project dashboard. + +![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_list.png) ## Trigger Edge Functions -Webhooks can also be used to trigger your edge functions, either via HTTP or Websockets request, or on a database event. \ No newline at end of file + +Webhooks in SQLite Cloud aren't limited to data capture—they can also **trigger Edge Functions**: + +* Via HTTP or WebSocket +* In response to database write events + +This allows developers to build distributed, event-driven applications that react immediately to changes at the edge. \ No newline at end of file From d94545664b08a3dbf1280f0960a82181b0eb69ef Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:14:34 +0200 Subject: [PATCH 146/185] Fix link in sqlite-ai.mdx --- sqlite-cloud/sqlite-ai/sqlite-ai.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx index 7d43c74..524ebc3 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx @@ -6,8 +6,8 @@ status: publish slug: sqlite-ai --- -[SQLite-AI](https://website-stage.sqlitecloud.io/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. +[SQLite-AI](https://sqlitecloud.io/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. With a simple SQL interface, you can chat with a model, stream tokens in real time, generate high-quality embeddings, or transcribe and translate audio using Whisper. Multimodal features allow image processing and embedding, making SQLite-AI a versatile foundation for modern AI applications. -**SQLite-AI** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-ai). \ No newline at end of file +**SQLite-AI** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-ai). From 2072e00da56fa6ffbedce028a0b1a4339fc517eb Mon Sep 17 00:00:00 2001 From: Gioele Cantoni <48024736+Gioee@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:31:50 +0200 Subject: [PATCH 147/185] Fix sqlite-ai link use correct domain --- sqlite-cloud/sqlite-ai/sqlite-ai.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx index 524ebc3..6e47c04 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx @@ -6,7 +6,7 @@ status: publish slug: sqlite-ai --- -[SQLite-AI](https://sqlitecloud.io/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. +[SQLite-AI](https://sqlite.ai/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. With a simple SQL interface, you can chat with a model, stream tokens in real time, generate high-quality embeddings, or transcribe and translate audio using Whisper. Multimodal features allow image processing and embedding, making SQLite-AI a versatile foundation for modern AI applications. From 29d492881aeff0970ce43a37d135c886f13aba06 Mon Sep 17 00:00:00 2001 From: Andrea Donetti Date: Thu, 7 Aug 2025 09:54:02 +0200 Subject: [PATCH 148/185] Update rls.mdx --- sqlite-cloud/platform/rls.mdx | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index b1034e2..6f24472 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -85,9 +85,9 @@ Suppose you have a `tasks` table with the following schema: ```sql CREATE TABLE tasks ( - id INTEGER PRIMARY KEY, + id TEXT PRIMARY KEY NOT NULL, + user_id TEXT, title TEXT, - owner_id INTEGER, status TEXT ); ``` @@ -98,39 +98,46 @@ Here are a few examples of RLS policies you can create: ```sql -- SELECT policy -owner_id = auth_userid() +user_id = auth_userid() ``` **2. Users can only insert tasks for themselves.** ```sql -- INSERT policy -NEW.owner_id = auth_userid() +NEW.user_id = auth_userid() ``` **3. Users can only update the status of their own tasks.** ```sql -- UPDATE policy -OLD.owner_id = auth_userid() +OLD.user_id = auth_userid() ``` -**4. Users with the 'admin' group can see all tasks.** +**4. Users can only delete their own tasks.** + +```sql +-- DELETE policy +OLD.user_id = auth_userid() +``` + +**5. Users with the 'admin' group can see all tasks.** ```sql -- SELECT policy json_extract(auth_json(), '$.attributes.group') = 'admin' ``` -**5. Role-Based Access within a Tenancy** +**6. Role-Based Access within a Tenancy** ```sql -- SELECT policy org_id = json_extract(auth_json(), '$.attributes.org_id') AND -(json_extract(auth_json(), '$.attributes.role') = 'admin' OR owner_id = auth_userid()) +(json_extract(auth_json(), '$.attributes.role') = 'admin' OR user_id = auth_userid()) ``` -**6. Access via a Membership Linking Table** +**7. Access via a Membership Linking Table** ```sql -- SELECT policy @@ -141,11 +148,11 @@ EXISTS ( ) ``` -**7. Public vs. Private Record Visibility** +**8. Public vs. Private Record Visibility** ```sql -- SELECT policy -visibility = 'public' OR owner_id = auth_userid() +visibility = 'public' OR user_id = auth_userid() ``` With these policies, when a user executes a query, SQLite Cloud will automatically enforce the defined RLS rules, ensuring data security and compliance. From 208ba487802209b5f082ab6286fd2a51290b9038 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 25 Aug 2025 12:04:14 +0200 Subject: [PATCH 149/185] wip --- sqlite-cloud/create-database.mdx | 9 +++++++-- sqlite-cloud/write-data.mdx | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index 852f8f4..c57b7e1 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -6,6 +6,10 @@ 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 @@ -26,7 +30,8 @@ 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. @@ -34,7 +39,7 @@ Select the database file you want to upload, and click "Upload Database". The da ### 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. diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 264d55e..f22dfbe 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -5,13 +5,16 @@ category: getting-started status: publish slug: write-data --- +import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; +import studioInsert from '@docs-website-assets/introduction/video/dashboard_studio.mp4'; + After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. ## Writing data with the SQLite Cloud UI Navigate to the console tab in the left-hand navigation. From here, you can run SQL commands against your cluster. Use the optional dropdown menus to select a database and table. -![Dashboard Projects](@docs-website-assets/introduction/dashboard_console.png) + ### Example ```sql From 0f365192bd6107e6529c67a2ee81556528a1a0f5 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 26 Aug 2025 12:25:41 +0200 Subject: [PATCH 150/185] wip --- sqlite-cloud/platform/apikey.mdx | 2 +- sqlite-cloud/platform/backups.mdx | 17 +++--- sqlite-cloud/platform/edge-functions.mdx | 70 +++++++++++++++++++----- sqlite-cloud/platform/webhooks.mdx | 10 +++- sqlite-cloud/write-data.mdx | 7 ++- 5 files changed, 78 insertions(+), 28 deletions(-) diff --git a/sqlite-cloud/platform/apikey.mdx b/sqlite-cloud/platform/apikey.mdx index ee08944..87a5a97 100644 --- a/sqlite-cloud/platform/apikey.mdx +++ b/sqlite-cloud/platform/apikey.mdx @@ -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) diff --git a/sqlite-cloud/platform/backups.mdx b/sqlite-cloud/platform/backups.mdx index 969d7e1..705b64b 100644 --- a/sqlite-cloud/platform/backups.mdx +++ b/sqlite-cloud/platform/backups.mdx @@ -6,8 +6,12 @@ status: publish slug: backups --- +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'; + ## 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. +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. @@ -23,18 +27,11 @@ SQLite Cloud creates a full snapshot backup of your data once a day, and stores ## 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) + -Click save, and your database backups will appear below. -![Backup Items](@docs-website-assets/introduction/backup_items.png) ### 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) + diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index 5f2def1..83c7c05 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -5,6 +5,8 @@ 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'; Edge functions let you define custom logic to run on the same nodes as your database files for ultra-fast performance. @@ -15,11 +17,59 @@ 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. + +This guide explains how to create, deploy, and test Edge Functions in the SQLite Cloud UI. + + + + + +1. Open the Edge Functions Section + - From the left-hand sidebar, click the **Edge Functions** icon. + - You will see the list of your functions on the left and the code editor on the right. + +2. Create a New Function + - Click the **+** button next to *Filter functions...*. + - Choose the function type: **SQL**, **JavaScript**, or **TypeScript**. + - A new function (e.g., `function-1`) will appear in the list. + +3. Write Your Function Code + - Use the editor to implement your logic. + - You can include request parameters, execute SQL queries, and return custom objects. + +4. Select the Target Database + - At the bottom of the editor, choose the database (e.g., `chinook.sqlite`). + - You can search and switch databases if needed. + +5. Deploy the Function + - Before testing, you must **Deploy** the function. + - Click the **Deploy** button in the bottom-right corner. + - The function is now active and ready to be tested. + +6. Test the Function + - After deployment, click **Test**. + - A panel will open on the right where you can configure: + - **User** → choose a user with access to the selected database. + - **API Key** → select the appropriate key. + - **Request Body** → provide JSON input (e.g., `{ "filter": "a" }`). + - **Query Parameters** → add parameters (e.g., `limit = 10`). + - Click **Send Request** to execute the test. + +7. Review the Response + - The response will be shown at the bottom of the test panel. + - It includes your custom message, the SQL results, and the request object. + +8. Enable Linearizable Reads (Optional) + - If your database is frequently modified and you want strong consistency, + toggle **Linearizable** at the bottom before testing or deploying. + +9. View the Function Details + - Switch to the **Details** tab to check deployment information. + - You can see: + - The **last deployed date and time**. + - The **Function URL**, which you can copy and use to call the function from external applications + + #### Note: Functions should return a JSON-serializable object with a data field: @@ -32,9 +82,9 @@ return { ``` ### 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 @@ -42,12 +92,6 @@ Edge functions can be called via HTTP GET and POST methods. You can pass additio - 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 diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index 3eb6e0d..7003b33 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -5,16 +5,21 @@ category: platform status: publish slug: webhooks --- +import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; +import webhooksUrl from '@docs-website-assets/introduction/video/dashboard_webhooks_trigger_url.mp4'; +import webhooksEdgeFunction from '@docs-website-assets/introduction/video/dashboard_webhooks_trigger_edge_function.mp4.mp4'; **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. ## Real-Time Notifications for Database Writes + Use the **Webhooks panel** to effortlessly create real-time notifications for write operations—such as inserts, updates, or deletes—within your SQLite Cloud database. For example, you can configure SQLite Cloud to notify a [webhook.site](https://webhook.site) endpoint every time a write operation occurs on the `albums` table of the `chinook.sqlite` database. -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create.png) + + ## Change Data Capture @@ -29,7 +34,7 @@ This enables seamless integration with logging systems, monitoring dashboards, o Upon creation, each webhook is assigned a **secret key** used to verify the authenticity of incoming requests. -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_create2.png) +![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_secret.png) You can also manage and review all active webhooks from your project dashboard. @@ -41,5 +46,6 @@ Webhooks in SQLite Cloud aren't limited to data capture—they can also **trigge * Via HTTP or WebSocket * In response to database write events + This allows developers to build distributed, event-driven applications that react immediately to changes at the edge. \ No newline at end of file diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index f22dfbe..2e7a906 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -8,11 +8,14 @@ slug: write-data import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; import studioInsert from '@docs-website-assets/introduction/video/dashboard_studio.mp4'; - After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. ## Writing data with the SQLite Cloud UI -Navigate to the console tab in the left-hand navigation. From here, you can run SQL commands against your cluster. Use the optional dropdown menus to select a database and table. +Navigate to the Studio tab from the left-hand navigation. From here, you can run SQL commands directly on your cluster. +If needed, use the dropdown menus to select the database and table where you want to insert or update data. + +Alternatively, you can also interact directly with the table view to add new records or update existing ones without writing SQL manually. + From 8decf8d7481643ede6982ffea8acde804f09280c Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 27 Aug 2025 13:14:48 +0200 Subject: [PATCH 151/185] wip --- sqlite-cloud/create-database.mdx | 6 +- sqlite-cloud/platform/analyzer.mdx | 18 +++--- sqlite-cloud/platform/edge-functions.mdx | 73 ++++++++---------------- sqlite-cloud/platform/offsync.mdx | 31 ++++++++-- sqlite-cloud/platform/rls.mdx | 37 ++++++++++-- sqlite-cloud/platform/webhooks.mdx | 60 ++++++++++++++++++- 6 files changed, 154 insertions(+), 71 deletions(-) diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index c57b7e1..e9f83be 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -31,17 +31,19 @@ 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. +Select the database file you want to upload, and click "Upload Database". The database will be available in your cluster within a few minutes. + -Select the database file you want to upload, and click "Upload Database". The database will be available in your cluster within a few minutes. ## 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. - The default encoding is set to UTF-8, and the default page size is 4096KB. + + ### 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: diff --git a/sqlite-cloud/platform/analyzer.mdx b/sqlite-cloud/platform/analyzer.mdx index e3b830a..877e1a4 100644 --- a/sqlite-cloud/platform/analyzer.mdx +++ b/sqlite-cloud/platform/analyzer.mdx @@ -5,25 +5,29 @@ 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) + 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. -![Dashboard Analyzer Settings](@docs-website-assets/introduction/dashboard_analyzer_settings.png) -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) +## 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'`; + -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. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index 83c7c05..ba2e6ed 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -8,6 +8,8 @@ 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. You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported. @@ -18,68 +20,41 @@ Turning on linearizable reads ensures strong consistency, but may introduce some ## Getting Started -This guide explains how to create, deploy, and test Edge Functions in the SQLite Cloud UI. - - - +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. -1. Open the Edge Functions Section - - From the left-hand sidebar, click the **Edge Functions** icon. - - You will see the list of your functions on the left and the code editor on the right. + -2. Create a New Function - - Click the **+** button next to *Filter functions...*. - - Choose the function type: **SQL**, **JavaScript**, or **TypeScript**. - - A new function (e.g., `function-1`) will appear in the list. +#### Note: +Functions should return a JSON-serializable object with a data field: +```js +return { + data: { + // your return object + } +} +``` -3. Write Your Function Code - - Use the editor to implement your logic. - - You can include request parameters, execute SQL queries, and return custom objects. -4. Select the Target Database - - At the bottom of the editor, choose the database (e.g., `chinook.sqlite`). - - You can search and switch databases if needed. -5. Deploy the Function - - Before testing, you must **Deploy** the function. - - Click the **Deploy** button in the bottom-right corner. - - The function is now active and ready to be tested. + +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. + -6. Test the Function - - After deployment, click **Test**. - - A panel will open on the right where you can configure: - - **User** → choose a user with access to the selected database. - - **API Key** → select the appropriate key. - - **Request Body** → provide JSON input (e.g., `{ "filter": "a" }`). - - **Query Parameters** → add parameters (e.g., `limit = 10`). - - Click **Send Request** to execute the test. -7. Review the Response - - The response will be shown at the bottom of the test panel. - - It includes your custom message, the SQL results, and the request object. +### Function Details -8. Enable Linearizable Reads (Optional) - - If your database is frequently modified and you want strong consistency, - toggle **Linearizable** at the bottom before testing or deploying. +In the **Details** tab you will find key information about your function, including: -9. View the Function Details - - Switch to the **Details** tab to check deployment information. - - You can see: - - The **last deployed date and time**. - - The **Function URL**, which you can copy and use to call the function from external applications +- 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) -#### Note: -Functions should return a JSON-serializable object with a data field: -```js -return { - data: { - // your return object - } -} -``` ### Authorization Edge functions that access your SQLite databases must be authorized via API key. diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx index 2924156..71d19e8 100644 --- a/sqlite-cloud/platform/offsync.mdx +++ b/sqlite-cloud/platform/offsync.mdx @@ -6,6 +6,13 @@ 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. @@ -24,16 +31,28 @@ When combined with [Row-Level Security (RLS)](/docs/rls), OffSync allows you to ## 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: + +### 1. 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. + + + + +### 2. 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. + - ![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. +### 3. 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) + 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. diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index 6f24472..f4d2f16 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -6,6 +6,12 @@ status: publish slug: rls --- +import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; +import rlsEnable from '@docs-website-assets/introduction/video/dashboard_rls_enable.mp4'; +import rlsTest from '@docs-website-assets/introduction/video/dashboard_rls_test.mp4'; + + + import Callout from "@commons-components/Information/Callout.astro"; 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. @@ -38,14 +44,12 @@ Otherwise, they will be blocked from accessing any rows. You can configure RLS policies for your databases through the SQLite Cloud dashboard. + + 1. **Navigate to the Databases Page**: From the main dashboard, go to the "Databases" page. 2. **Select the RLS Column**: In the list of your databases, click on the button in the "RLS" column for the desired database. - - ![Dashboard Databases Page](@docs-website-assets/introduction/rls-1.png) - 3. **Configure RLS Settings**: On the RLS settings page, you can define the policies for each table. - ![Dashboard RLS Settings Page](@docs-website-assets/introduction/rls-2.png) For each table, you can specify the following RLS policies: @@ -58,6 +62,31 @@ You can configure RLS policies for your databases through the SQLite Cloud dashb 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. +## Testing RLS + + +To verify that your Row-Level Security (RLS) policies work as expected, you can use the **Test RLS** feature in the dashboard: + +1. **Open the Test Panel** + On the RLS policies page, click **Test** to open the dedicated testing panel. + +2. **Generate an Access Token** + - Go to the **Weblite page** and use the `POST /v2/tokens` endpoint. + - Provide a request body with a `userId`, a `name`, and any attributes required by your RLS policies (for example: `role`, `enabled`, etc.). + - Execute the request and copy the `token` value from the response. + +3. **Authenticate in the Test Panel** + - Paste the generated token into the **Enter Access Token** field and click **Authorize**. + - The dashboard will now simulate queries to the database as if they were executed by the user identified in the token. + +4. **View Filtered Data** + - Once authenticated, you can navigate through the database tables directly from the test panel. + - Only the rows allowed by your RLS rules will be displayed (for example, activities tied to the `user_id` in the token or accessible with the `coach` role). + +5. **Compare with Full Data** + - By switching back to **Database Studio**, you can see all rows in the table without RLS filters. + - This allows you to compare the filtered view (via token) with the complete dataset and confirm that your policies are correctly enforced. + ### User Information Functions To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user: diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index 7003b33..9cc1635 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -21,6 +21,7 @@ For example, you can configure SQLite Cloud to notify a [webhook.site](https://w + ## Change Data Capture Change Data Webhooks let you send structured HTTP requests to any external service whenever a row in a specific database and/or table is modified. These webhooks include: @@ -32,13 +33,43 @@ Change Data Webhooks let you send structured HTTP requests to any external servi This enables seamless integration with logging systems, monitoring dashboards, or external APIs that react to database activity. + +### Payload Fields + +```json +{ + "type": "insert", + "database": "chinook.sqlite", + "table": "albums", + "column": [ + "AlbumId" + ], + "data": [ + 349 + ], + "webhook": { + "id": 1, + "action": "https://webhook.site/70792a3c-2a18-4a48-9ded-df1c90e758ce", + "options": { + "type": "url" + } + } +} +``` + +* **type** – The operation type (`insert`, `update`, or `delete`). +* **database** – The name of the database where the change occurred. +* **table** – The table affected by the operation. +* **column** – An array listing the column(s) involved in the operation. +* **data** – The values corresponding to the affected row(s). +* **webhook** – Metadata about the webhook itself, including its unique `id`, target `action` (URL or Edge Function), and configuration `options`. + +## Security + Upon creation, each webhook is assigned a **secret key** used to verify the authenticity of incoming requests. ![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_secret.png) -You can also manage and review all active webhooks from your project dashboard. - -![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_list.png) ## Trigger Edge Functions @@ -46,6 +77,29 @@ Webhooks in SQLite Cloud aren't limited to data capture—they can also **trigge * Via HTTP or WebSocket * In response to database write events + +Within an Edge Function, the webhook payload containing the **Change Data Capture** information is directly accessible through the `request.data` variable, which is available by default in all Edge Functions. + +```js +// Get secret from database +const slackWebhookEndpoint = await connection.sql`GET ENV slack_webhook_endpoint`; + +// Get record sent in body via webhook +const content = request.data; + +// Define helpers to assign and notify +const notifyRep = async ( ) => { + await fetch(slackWebhookEndpoint, { body: JSON.stringify({ text: "Discover the Latest Album Releases" + JSON.stringify(request.data)}), method: 'POST', 'Content-type': 'application/json' }); +} + +// Call async functions +await notifyRep(); + +return { + data: 'OK' +} +``` + This allows developers to build distributed, event-driven applications that react immediately to changes at the edge. \ No newline at end of file From 4776d8307a4ab1950139a945b860b7ee103e375c Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 27 Aug 2025 13:30:20 +0200 Subject: [PATCH 152/185] wip --- sqlite-cloud/platform/analyzer.mdx | 9 ++-- sqlite-cloud/platform/backups.mdx | 10 +++-- sqlite-cloud/platform/edge-functions.mdx | 6 +++ sqlite-cloud/platform/offsync.mdx | 14 ++++--- sqlite-cloud/platform/rls.mdx | 53 +++++++++++++++--------- sqlite-cloud/platform/security.mdx | 4 +- sqlite-cloud/platform/webhooks.mdx | 9 +++- 7 files changed, 72 insertions(+), 33 deletions(-) diff --git a/sqlite-cloud/platform/analyzer.mdx b/sqlite-cloud/platform/analyzer.mdx index 877e1a4..9338584 100644 --- a/sqlite-cloud/platform/analyzer.mdx +++ b/sqlite-cloud/platform/analyzer.mdx @@ -12,16 +12,19 @@ import applyAnalyzer from '@docs-website-assets/introduction/video/dashboard_ana 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. +## 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. + +---- ## 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'`; -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'`; 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. diff --git a/sqlite-cloud/platform/backups.mdx b/sqlite-cloud/platform/backups.mdx index 705b64b..73aebb9 100644 --- a/sqlite-cloud/platform/backups.mdx +++ b/sqlite-cloud/platform/backups.mdx @@ -10,11 +10,12 @@ 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'; -## Overview 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 @@ -24,13 +25,16 @@ 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. - -### 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. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index ba2e6ed..9525f23 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -18,6 +18,8 @@ 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 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 - Query parameters: Accessible via `request.params` - Request body: Accessible via `request.data` +--- ## Guides ### Interacting with your Database @@ -102,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 diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx index 71d19e8..410d83b 100644 --- a/sqlite-cloud/platform/offsync.mdx +++ b/sqlite-cloud/platform/offsync.mdx @@ -11,14 +11,15 @@ import enableSync from '@docs-website-assets/introduction/video/dashboard_sqlite 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. @@ -29,26 +30,29 @@ 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. Below are the main steps: -### 1. Enable Tables for Synchronization +### 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. -### 2. Get the Connection String +### 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. -### 3. Manage Connected Devices +### 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. diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index f4d2f16..0d229bb 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -10,8 +10,6 @@ import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; import rlsEnable from '@docs-website-assets/introduction/video/dashboard_rls_enable.mp4'; import rlsTest from '@docs-website-assets/introduction/video/dashboard_rls_test.mp4'; - - import Callout from "@commons-components/Information/Callout.astro"; 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 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. +--- + ## Policy Enforcement 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 Otherwise, they will be blocked from accessing any rows. +--- + ## Configuring RLS 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 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. +### User Information Functions + +To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user: + +- `auth_userid()`: Returns the `userid` of the current token-authenticated user. +- `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`. + +These functions are particularly useful for creating policies that are based on user attributes. + +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/). + +### OLD and NEW References + +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: + +| Operation | `OLD.column` Reference | `NEW.column` Reference | +| :--- | :--- | :--- | +| `INSERT` | Not available | The value for the new row. | +| `UPDATE` | The value of the row *before* the update. | The value of the row *after* the update. | +| `DELETE` | The value of the row being deleted. | Not available | + +--- + ## Testing RLS + 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 - By switching back to **Database Studio**, you can see all rows in the table without RLS filters. - This allows you to compare the filtered view (via token) with the complete dataset and confirm that your policies are correctly enforced. -### User Information Functions -To help you create dynamic RLS policies, SQLite Cloud provides two functions to retrieve information about the current authenticated user: -- `auth_userid()`: Returns the `userid` of the current token-authenticated user. -- `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`. - -These functions are particularly useful for creating policies that are based on user attributes. - -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/). -### OLD and NEW References - -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: - -| Operation | `OLD.column` Reference | `NEW.column` Reference | -| :--- | :--- | :--- | -| `INSERT` | Not available | The value for the new row. | -| `UPDATE` | The value of the row *before* the update. | The value of the row *after* the update. | -| `DELETE` | The value of the row being deleted. | Not available | +--- ## Example @@ -245,7 +255,10 @@ OLD.status <> 'paid' **Explanation:** 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. -### Advanced: RLS and SQLite Sync + +--- + +## Advanced: RLS and SQLite Sync 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. diff --git a/sqlite-cloud/platform/security.mdx b/sqlite-cloud/platform/security.mdx index 3cd63e5..57a6a3e 100644 --- a/sqlite-cloud/platform/security.mdx +++ b/sqlite-cloud/platform/security.mdx @@ -15,6 +15,8 @@ To add new users to your cluster, simply click on the **Create User** button. Once a user is successfully created, you can assign one or more roles to them to determine their level of access to the system. +--- + ## Roles 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. @@ -29,7 +31,7 @@ There are two types of roles in SQLite Cloud: ![Dashboard Roles](@docs-website-assets/introduction/dashboard_roles.png) -## Built-in roles +### Built-in roles import Callout from "@commons-components/Information/Callout.astro"; 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. diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index 9cc1635..72b610e 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -11,6 +11,10 @@ import webhooksEdgeFunction from '@docs-website-assets/introduction/video/dashbo **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. + +--- + + ## Real-Time Notifications for Database Writes @@ -20,7 +24,7 @@ For example, you can configure SQLite Cloud to notify a [webhook.site](https://w - +--- ## Change Data Capture @@ -64,12 +68,15 @@ This enables seamless integration with logging systems, monitoring dashboards, o * **data** – The values corresponding to the affected row(s). * **webhook** – Metadata about the webhook itself, including its unique `id`, target `action` (URL or Edge Function), and configuration `options`. +--- + ## Security Upon creation, each webhook is assigned a **secret key** used to verify the authenticity of incoming requests. ![Dashboard Projects](@docs-website-assets/introduction/dashboard_webhook_secret.png) +--- ## Trigger Edge Functions From be417b0c20815c7736fc3405e0d424c66cc55ec5 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Wed, 27 Aug 2025 14:16:41 +0200 Subject: [PATCH 153/185] wip --- sqlite-cloud/connect-cluster.mdx | 8 ++++++++ sqlite-cloud/create-database.mdx | 3 +++ sqlite-cloud/write-data.mdx | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/sqlite-cloud/connect-cluster.mdx b/sqlite-cloud/connect-cluster.mdx index 6fa8f72..ef7b444 100644 --- a/sqlite-cloud/connect-cluster.mdx +++ b/sqlite-cloud/connect-cluster.mdx @@ -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: @@ -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: @@ -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) diff --git a/sqlite-cloud/create-database.mdx b/sqlite-cloud/create-database.mdx index e9f83be..f98e205 100644 --- a/sqlite-cloud/create-database.mdx +++ b/sqlite-cloud/create-database.mdx @@ -12,6 +12,8 @@ import createDb from '@docs-website-assets/introduction/video/dashboard_create_d 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. @@ -35,6 +37,7 @@ Select the database file you want to upload, and click "Upload Database". The da +--- ## Creating a new database ### From the Dashboard diff --git a/sqlite-cloud/write-data.mdx b/sqlite-cloud/write-data.mdx index 2e7a906..42e629a 100644 --- a/sqlite-cloud/write-data.mdx +++ b/sqlite-cloud/write-data.mdx @@ -10,6 +10,8 @@ import studioInsert from '@docs-website-assets/introduction/video/dashboard_stud After you've created a database in SQLite Cloud, you can start writing data to it. You can write data to your cluster using the SQLite Cloud UI, API, or client libraries. +--- + ## Writing data with the SQLite Cloud UI Navigate to the Studio tab from the left-hand navigation. From here, you can run SQL commands directly on your cluster. If needed, use the dropdown menus to select the database and table where you want to insert or update data. @@ -29,6 +31,8 @@ CREATE TABLE sports_cars (sc_id INTEGER PRIMARY KEY, sc_make TEXT NOT NULL, sc_y INSERT INTO sports_cars (sc_make, sc_year) VALUES ('Ferrari', 2021); ``` +--- + ## Writing data with the Weblite API You can use the [Weblite API](/docs/weblite) to run SQL commands against your cluster. Here is an example cURL request: @@ -40,6 +44,8 @@ curl -X 'POST' \ -d '' ``` +--- + ## Writing data with client libraries To write data to your cluster using a client library, use the INSERT INTO SQL command. From e4ca2766f407a0727a9d04640596ae2f9a7cdd46 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Fri, 26 Sep 2025 11:42:37 +0200 Subject: [PATCH 154/185] placeholder aisearch.yaml --- .github/workflows/aisearch.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/aisearch.yaml diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml new file mode 100644 index 0000000..80b986b --- /dev/null +++ b/.github/workflows/aisearch.yaml @@ -0,0 +1,18 @@ +name: Process docs for SQLite AI Search + +on: + workflow_dispatch: + +jobs: + docsearch: + runs-on: ubuntu-latest + environment: ${{ github.ref_name }} + + steps: + - uses: actions/checkout@v4 + + # - uses: sqlitecloud/sqlite-ai-action@v1 + # with: + # project-string: ${{ secrets.PROJECT_STRING }} + # base-url: ${{ vars.BASE_URL }} + # database: documentation_ai.sqlite From f85207f1d84779c3e838f97f198dc4b129a50eeb Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Sat, 27 Sep 2025 15:28:55 +0200 Subject: [PATCH 155/185] fix: set source files path --- .github/workflows/aisearch.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml index 91539df..a850b67 100644 --- a/.github/workflows/aisearch.yaml +++ b/.github/workflows/aisearch.yaml @@ -22,3 +22,4 @@ jobs: connection_string: ${{ secrets.PROJECT_STRING }} base_url: ${{ vars.BASE_URL }} database_name: documentation_ai.sqlite + source_files: ./ From 8612ed4f7fcccb3f0048aec7eab56a43972dc4cb Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Fri, 26 Sep 2025 11:42:37 +0200 Subject: [PATCH 156/185] placeholder aisearch.yaml --- .github/workflows/aisearch.yaml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml index a850b67..80b986b 100644 --- a/.github/workflows/aisearch.yaml +++ b/.github/workflows/aisearch.yaml @@ -2,24 +2,17 @@ name: Process docs for SQLite AI Search on: workflow_dispatch: - push: - branches: - - main - - stage - + jobs: - aisearch: + docsearch: runs-on: ubuntu-latest environment: ${{ github.ref_name }} - permissions: - contents: read steps: - uses: actions/checkout@v4 - - uses: sqliteai/sqlite-aisearch-action@v1 - with: - connection_string: ${{ secrets.PROJECT_STRING }} - base_url: ${{ vars.BASE_URL }} - database_name: documentation_ai.sqlite - source_files: ./ + # - uses: sqlitecloud/sqlite-ai-action@v1 + # with: + # project-string: ${{ secrets.PROJECT_STRING }} + # base-url: ${{ vars.BASE_URL }} + # database: documentation_ai.sqlite From e4c9a3ddf5a5e81dd221240f479e303f32aa7547 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Tue, 30 Sep 2025 11:32:46 +0200 Subject: [PATCH 157/185] docs: update sqlite sync docs --- .github/workflows/aisearch.yaml | 23 +- sqlite-cloud/sqlite-ai/sqlite-sync.mdx | 15 -- .../api-reference/cloudsync_begin_alter.md | 19 ++ .../api-reference/cloudsync_cleanup.md | 17 ++ .../api-reference/cloudsync_commit_alter.md | 19 ++ .../api-reference/cloudsync_db_version.md | 13 ++ .../api-reference/cloudsync_disable.md | 15 ++ .../api-reference/cloudsync_enable.md | 15 ++ .../api-reference/cloudsync_init.md | 46 ++++ .../api-reference/cloudsync_is_enabled.md | 15 ++ .../cloudsync_network_check_changes.md | 23 ++ .../cloudsync_network_cleanup.md | 13 ++ .../cloudsync_network_has_unsent_changes.md | 13 ++ .../api-reference/cloudsync_network_init.md | 15 ++ .../api-reference/cloudsync_network_logout.md | 13 ++ .../cloudsync_network_reset_sync_version.md | 13 ++ .../cloudsync_network_send_changes.md | 15 ++ .../cloudsync_network_set_apikey.md | 15 ++ .../cloudsync_network_set_token.md | 15 ++ .../api-reference/cloudsync_network_sync.md | 25 ++ .../api-reference/cloudsync_siteid.md | 13 ++ .../api-reference/cloudsync_terminate.md | 14 ++ .../api-reference/cloudsync_uuid.md | 13 ++ .../api-reference/cloudsync_version.md | 14 ++ .../sqlite-ai/sqlite-sync/best-practices.md | 104 +++++++++ .../sqlite-ai/sqlite-sync/getting-started.md | 120 ++++++++++ .../sqlite-ai/sqlite-sync/introduction.md | 98 ++++++++ .../sqlite-sync/quick-starts/android.md | 156 +++++++++++++ .../sqlite-ai/sqlite-sync/quick-starts/ios.md | 202 +++++++++++++++++ .../sqlite-sync/quick-starts/linux.md | 60 +++++ .../sqlite-sync/quick-starts/macos.md | 101 +++++++++ .../quick-starts/react-native-expo.md | 163 ++++++++++++++ .../sqlite-sync/quick-starts/wasm.md | 94 ++++++++ .../sqlite-sync/quick-starts/windows.md | 213 ++++++++++++++++++ 34 files changed, 1699 insertions(+), 23 deletions(-) delete mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync.mdx create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md create mode 100644 sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml index 80b986b..e7f02f0 100644 --- a/.github/workflows/aisearch.yaml +++ b/.github/workflows/aisearch.yaml @@ -2,17 +2,24 @@ name: Process docs for SQLite AI Search on: workflow_dispatch: - + push: + branches: + - main + - stage + jobs: - docsearch: + aisearch: runs-on: ubuntu-latest environment: ${{ github.ref_name }} + permissions: + contents: read steps: - uses: actions/checkout@v4 - - # - uses: sqlitecloud/sqlite-ai-action@v1 - # with: - # project-string: ${{ secrets.PROJECT_STRING }} - # base-url: ${{ vars.BASE_URL }} - # database: documentation_ai.sqlite + + - uses: sqliteai/sqlite-aisearch-action@v1 + with: + connection_string: ${{ secrets.PROJECT_STRING }} + base_url: ${{ vars.BASE_URL }} + database_name: documentation_ai.sqlite + source_files: ./ diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync.mdx b/sqlite-cloud/sqlite-ai/sqlite-sync.mdx deleted file mode 100644 index 5815c48..0000000 --- a/sqlite-cloud/sqlite-ai/sqlite-sync.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: SQLite-Sync -description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. -category: platform -status: publish -slug: sqlite-sync ---- - -[SQLite-Sync](https://website-stage.sqlitecloud.io/sqlite-sync) is a cross-platform extension that adds built-in offline support and automatic synchronization to standard SQLite databases, enabling a **true local-first experience with zero latency**. Applications can operate fully offline, with each device maintaining its own copy of the database - -When reconnected, all changes are seamlessly synchronized across devices. Developers can continue using the familiar simplicity and performance of SQLite while easily building distributed, collaborative applications without complex infrastructure. - -SQLite Sync is powered by CRDTs (Conflict-free Replicated Data Types), a class of algorithms designed for real-time collaboration and distributed systems. CRDTs ensure that changes made on different devices are merged automatically and without conflicts, even when made offline. This means no data loss, no overwrites, and no need for manual conflict resolution. Whether it's a multi-user app or a fleet of devices operating in the field, SQLite Sync keeps everything consistent and in sync automatically. - -**SQLite-Sync** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-sync). \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md new file mode 100644 index 0000000..9f80884 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md @@ -0,0 +1,19 @@ +### `cloudsync_begin_alter(table_name)` + +**Description:** Prepares a synchronized table for schema changes. This function must be called before altering the table. Failure to use `cloudsync_begin_alter` and `cloudsync_commit_alter` can lead to synchronization errors and data divergence. + +**Parameters:** + +- `table_name` (TEXT): The name of the table that will be altered. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_init('my_table'); +-- ... later +SELECT cloudsync_begin_alter('my_table'); +ALTER TABLE my_table ADD COLUMN new_column TEXT; +SELECT cloudsync_commit_alter('my_table'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md new file mode 100644 index 0000000..926ae77 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md @@ -0,0 +1,17 @@ +### `cloudsync_cleanup(table_name)` + +**Description:** Removes the `sqlite-sync` synchronization mechanism from a specified table or all tables. This operation drops the associated `_cloudsync` metadata table and removes triggers from the target table(s). Use this function when synchronization is no longer desired for a table. + +**Parameters:** + +- `table_name` (TEXT): The name of the table to clean up. + +**Returns:** None. + +**Example:** + +```sql +-- Clean up a single table +SELECT cloudsync_cleanup('my_table'); + +``` \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md new file mode 100644 index 0000000..1a7ad1c --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md @@ -0,0 +1,19 @@ +### `cloudsync_commit_alter(table_name)` + +**Description:** Finalizes schema changes for a synchronized table. This function must be called after altering the table's schema, completing the process initiated by `cloudsync_begin_alter` and ensuring CRDT data consistency. + +**Parameters:** + +- `table_name` (TEXT): The name of the table that was altered. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_init('my_table'); +-- ... later +SELECT cloudsync_begin_alter('my_type'); +ALTER TABLE my_table ADD COLUMN new_column TEXT; +SELECT cloudsync_commit_alter('my_table'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md new file mode 100644 index 0000000..9bcf704 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md @@ -0,0 +1,13 @@ +### `cloudsync_db_version()` + +**Description:** Returns the current database version. + +**Parameters:** None. + +**Returns:** The database version as an INTEGER. + +**Example:** + +```sql +SELECT cloudsync_db_version(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md new file mode 100644 index 0000000..3c86674 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md @@ -0,0 +1,15 @@ +### `cloudsync_disable(table_name)` + +**Description:** Disables synchronization for the specified table. + +**Parameters:** + +- `table_name` (TEXT): The name of the table to disable. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_disable('my_table'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md new file mode 100644 index 0000000..68c5cdf --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md @@ -0,0 +1,15 @@ +### `cloudsync_enable(table_name)` + +**Description:** Enables synchronization for the specified table. + +**Parameters:** + +- `table_name` (TEXT): The name of the table to enable. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_enable('my_table'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md new file mode 100644 index 0000000..c5d85df --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md @@ -0,0 +1,46 @@ +### `cloudsync_init(table_name, [crdt_algo], [force])` + +**Description:** Initializes a table for `sqlite-sync` synchronization. This function is idempotent and needs to be called only once per table on each site; configurations are stored in the database and automatically loaded with the extension. + +Before initialization, `cloudsync_init` performs schema sanity checks to ensure compatibility with CRDT requirements and best practices. These checks include: + +- Primary keys should not be auto-incrementing integers; GUIDs (UUIDs, ULIDs) are highly recommended to prevent multi-node collisions. +- All primary key columns must be `NOT NULL`. +- All non-primary key `NOT NULL` columns must have a `DEFAULT` value. + +**Schema Design Considerations:** + +When designing your database schema for SQLite Sync, follow these essential requirements: + +- **Primary Keys**: Use TEXT primary keys with `cloudsync_uuid()` for globally unique identifiers. Avoid auto-incrementing integers. +- **Column Constraints**: All NOT NULL columns (except primary keys) must have DEFAULT values to prevent synchronization errors. +- **UNIQUE Constraints**: In multi-tenant scenarios, use composite UNIQUE constraints (e.g., `UNIQUE(tenant_id, email)`) instead of global uniqueness. +- **Foreign Key Compatibility**: Be aware of potential conflicts during CRDT merge operations and RLS policy interactions. +- **Trigger Compatibility**: Triggers may cause duplicate operations or be called multiple times due to column-by-column processing. + +For comprehensive guidelines, see the [Database Schema Recommendations](https://github.com/sqliteai/sqlite-sync/blob/main/README.md#database-schema-recommendations) section. + +The function supports three overloads: + +- `cloudsync_init(table_name)`: Uses the default 'cls' CRDT algorithm. +- `cloudsync_init(table_name, crdt_algo)`: Specifies a CRDT algorithm ('cls', 'dws', 'aws', 'gos'). +- `cloudsync_init(table_name, crdt_algo, force)`: Specifies an algorithm and, if `force` is `true` (or `1`), skips the integer primary key check (use with caution, GUIDs are strongly recommended). + +**Parameters:** + +- `table_name` (TEXT): The name of the table to initialize. +- `crdt_algo` (TEXT, optional): The CRDT algorithm to use. Can be "cls", "dws", "aws", "gos". Defaults to "cls". +- `force` (BOOLEAN, optional): If `true` (or `1`), it skips the check that prevents the use of a single-column INTEGER primary key. Defaults to `false`. It is strongly recommended to use globally unique primary keys instead of integers. + +**Returns:** None. + +**Example:** + +```sql +-- Initialize a single table for synchronization with the Causal-Length Set (CLS) Algorithm (default) +SELECT cloudsync_init('my_table'); + +-- Initialize a single table for synchronization with a different algorithm Delete-Wins Set (DWS) +SELECT cloudsync_init('my_table', 'dws'); + +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md new file mode 100644 index 0000000..1b725f7 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md @@ -0,0 +1,15 @@ +### `cloudsync_is_enabled(table_name)` + +**Description:** Checks if synchronization is enabled for the specified table. + +**Parameters:** + +- `table_name` (TEXT): The name of the table to check. + +**Returns:** 1 if enabled, 0 otherwise. + +**Example:** + +```sql +SELECT cloudsync_is_enabled('my_table'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md new file mode 100644 index 0000000..7803920 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md @@ -0,0 +1,23 @@ +### `cloudsync_network_check_changes()` + +**Description:** Checks the remote server for new changes and applies them to the local database. + +If a package of new changes is already available for the local site, the server returns it immediately, and the changes are applied. If no package is ready, the server returns an empty response and starts an asynchronous process to prepare a new package. This new package can be retrieved with a subsequent call to this function. + +This function is designed to be called periodically to keep the local database in sync. +To force an update and wait for changes (with a timeout), use [`cloudsync_network_sync(wait_ms, max_retries)`]. + +If the network is misconfigured or the remote server is unreachable, the function returns an error. +On success, it returns `SQLITE_OK`, and the return value indicates how many changes were downloaded and applied. + +**Parameters:** None. + +**Returns:** The number of changes downloaded. Errors are reported via the SQLite return code. + +**Errors:** See [Network Errors](#network-errors) for common error conditions. + +**Example:** + +```sql +SELECT cloudsync_network_check_changes(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md new file mode 100644 index 0000000..4476bb6 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md @@ -0,0 +1,13 @@ +### `cloudsync_network_cleanup()` + +**Description:** Cleans up the `sqlite-sync` network component, releasing all resources allocated by `cloudsync_network_init` (memory, cURL handles). + +**Parameters:** None. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_cleanup(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md new file mode 100644 index 0000000..9b5f2b7 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md @@ -0,0 +1,13 @@ +### `cloudsync_network_has_unsent_changes()` + +**Description:** Checks if there are any local changes that have not yet been sent to the remote server. + +**Parameters:** None. + +**Returns:** 1 if there are unsent changes, 0 otherwise. + +**Example:** + +```sql +SELECT cloudsync_network_has_unsent_changes(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md new file mode 100644 index 0000000..83c8137 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md @@ -0,0 +1,15 @@ +### `cloudsync_network_init(connection_string)` + +**Description:** Initializes the `sqlite-sync` network component. This function parses the connection string to configure change checking and upload endpoints, and initializes the cURL library. + +**Parameters:** + +- `connection_string` (TEXT): The connection string for the remote synchronization server. The format is `sqlitecloud://:/?`. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_init('.sqlite.cloud/.sqlite'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md new file mode 100644 index 0000000..8a3c281 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md @@ -0,0 +1,13 @@ +### `cloudsync_network_logout()` + +**Description:** Logs out the current user and cleans up all local data from synchronized tables. This function deletes and then re-initializes synchronized tables, useful for switching users or resetting the local database. **Warning:** This function deletes all data from synchronized tables. Use with caution. + +**Parameters:** None. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_logout(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md new file mode 100644 index 0000000..e0d6fe6 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md @@ -0,0 +1,13 @@ +### `cloudsync_network_reset_sync_version()` + +**Description:** Resets local synchronization version numbers, forcing the next sync to fetch all changes from the server. + +**Parameters:** None. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_reset_sync_version(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md new file mode 100644 index 0000000..4b35f07 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md @@ -0,0 +1,15 @@ +### `cloudsync_network_send_changes()` + +**Description:** Sends all unsent local changes to the remote server. + +**Parameters:** None. + +**Returns:** None. + +**Errors:** See [Network Errors](#network-errors) for common error conditions. + +**Example:** + +```sql +SELECT cloudsync_network_send_changes(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md new file mode 100644 index 0000000..7b72a8b --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md @@ -0,0 +1,15 @@ +### `cloudsync_network_set_apikey(apikey)` + +**Description:** Sets the API key for network requests. This key is included in the `Authorization` header of all subsequent requests. + +**Parameters:** + +- `apikey` (TEXT): The API key. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_set_apikey('your_api_key'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md new file mode 100644 index 0000000..667551f --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md @@ -0,0 +1,15 @@ +### `cloudsync_network_set_token(token)` + +**Description:** Sets the authentication token to be used for network requests. This token will be included in the `Authorization` header of all subsequent requests. For more information, refer to the [Access Tokens documentation](https://docs.sqlitecloud.io/docs/access-tokens). + +**Parameters:** + +- `token` (TEXT): The authentication token. + +**Returns:** None. + +**Example:** + +```sql +SELECT cloudsync_network_set_token('your_auth_token'); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md new file mode 100644 index 0000000..649c7bd --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md @@ -0,0 +1,25 @@ +### `cloudsync_network_sync([wait_ms], [max_retries])` + +**Description:** Performs a full synchronization cycle. This function has two overloads: + +- `cloudsync_network_sync()`: Performs one send operation and one check operation. +- `cloudsync_network_sync(wait_ms, max_retries)`: Performs one send operation and then repeatedly tries to download remote changes until at least one change is downloaded or `max_retries` times has been reached, waiting `wait_ms` between retries. + +**Parameters:** + +- `wait_ms` (INTEGER, optional): The time to wait in milliseconds between retries. Defaults to 100. +- `max_retries` (INTEGER, optional): The maximum number of times to retry the synchronization. Defaults to 1. + +**Returns:** The number of changes downloaded. Errors are reported via the SQLite return code. + +**Errors:** See [Network Errors](#network-errors) for common error conditions. + +**Example:** + +```sql +-- Perform a single synchronization cycle +SELECT cloudsync_network_sync(); + +-- Perform a synchronization cycle with custom retry settings +SELECT cloudsync_network_sync(500, 3); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md new file mode 100644 index 0000000..7a3b2c6 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md @@ -0,0 +1,13 @@ +### `cloudsync_siteid()` + +**Description:** Returns the unique ID of the local site. + +**Parameters:** None. + +**Returns:** The site ID as a BLOB. + +**Example:** + +```sql +SELECT cloudsync_siteid(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md new file mode 100644 index 0000000..b9aa8c3 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md @@ -0,0 +1,14 @@ +### `cloudsync_terminate()` + +**Description:** Releases all internal resources used by the `sqlite-sync` extension for the current database connection. This function should be called before closing the database connection to ensure that all prepared statements and allocated memory are freed. Failing to call this function can result in memory leaks or a failed `sqlite3_close` operation due to pending statements. + +**Parameters:** None. + +**Returns:** None. + +**Example:** + +```sql +-- Before closing the database connection +SELECT cloudsync_terminate(); +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md new file mode 100644 index 0000000..a152ae8 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md @@ -0,0 +1,13 @@ +### `cloudsync_uuid()` + +**Description:** Generates a new universally unique identifier (UUIDv7). This is useful for creating globally unique primary keys for new records, which is a best practice for CRDTs. + +**Parameters:** None. + +**Returns:** A new UUID as a TEXT value. + +**Example:** + +```sql +INSERT INTO products (id, name) VALUES (cloudsync_uuid(), 'New Product'); +``` \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md new file mode 100644 index 0000000..5381550 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md @@ -0,0 +1,14 @@ +### `cloudsync_version()` + +**Description:** Returns the version of the `sqlite-sync` library. + +**Parameters:** None. + +**Returns:** The library version as a string. + +**Example:** + +```sql +SELECT cloudsync_version(); +-- e.g., '1.0.0' +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md b/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md new file mode 100644 index 0000000..1dbd2bc --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md @@ -0,0 +1,104 @@ +## Database Schema Recommendations + +When designing your database schema for SQLite Sync, follow these best practices to ensure optimal CRDT performance and conflict resolution: + +### Primary Key Requirements + +- **Use globally unique identifiers**: Always use TEXT primary keys with UUIDs, ULIDs, or similar globally unique identifiers +- **Avoid auto-incrementing integers**: Integer primary keys can cause conflicts across multiple devices +- **Use `cloudsync_uuid()`**: The built-in function generates UUIDv7 identifiers optimized for distributed systems +- **All primary keys must be explicitly declared as `NOT NULL`**. + +```sql +-- ✅ Recommended: Globally unique TEXT primary key +CREATE TABLE users ( + id TEXT PRIMARY KEY NOT NULL, -- Use cloudsync_uuid() + name TEXT NOT NULL, + email TEXT UNIQUE NOT NULL +); + +-- ❌ Avoid: Auto-incrementing integer primary key +CREATE TABLE users ( + id INTEGER PRIMARY KEY AUTOINCREMENT, -- Causes conflicts + name TEXT NOT NULL, + email TEXT UNIQUE NOT NULL +); +``` + +### Column Constraint Guidelines + +- **Provide DEFAULT values**: All `NOT NULL` columns (except primary keys) must have `DEFAULT` values +- **Consider nullable columns**: For optional data, use nullable columns instead of empty strings + +```sql +-- ✅ Recommended: Proper constraints and defaults +CREATE TABLE tasks ( + id TEXT PRIMARY KEY, + title TEXT NOT NULL DEFAULT '', + status TEXT NOT NULL DEFAULT 'pending', + priority INTEGER NOT NULL DEFAULT 1, + created_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')), + assigned_to TEXT -- Nullable for optional assignment +); +``` + +### UNIQUE Constraint Considerations + +When converting from single-tenant to multi-tenant database schemas with Row-Level Security, **UNIQUE constraints must be globally unique** across all tenants in the cloud database. For columns that should only be unique within a tenant, use composite UNIQUE constraints. + +```sql +-- ❌ Single-tenant: Unique email per database +CREATE TABLE users ( + id TEXT PRIMARY KEY, + email TEXT UNIQUE NOT NULL -- Problem: Not unique across tenants +); + +-- ✅ Multi-tenant: Composite unique constraint +CREATE TABLE users ( + id TEXT PRIMARY KEY, + tenant_id TEXT NOT NULL, + email TEXT NOT NULL, + UNIQUE(tenant_id, email) -- Unique email per tenant +); +``` + +### Foreign Key Compatibility + +When using foreign key constraints with SQLite Sync, be aware that interactions with the CRDT merge algorithm and Row-Level Security policies may cause constraint violations. + +#### Potential Conflicts + +**CRDT Merge Algorithm and DEFAULT Values** + +- CRDT changes are applied column-by-column during synchronization +- Columns may be temporarily assigned DEFAULT values during the merge process +- If a foreign key column has a DEFAULT value, that value must exist in the referenced table + +**Row-Level Security and CASCADE Actions** +- RLS policies may block operations required for maintaining referential integrity +- CASCADE DELETE/UPDATE operations may fail if RLS prevents access to related rows + +#### Recommendations + +**Database Design Patterns** +- Prefer application-level cascade logic over database-level CASCADE actions +- Design RLS policies to accommodate referential integrity operations +- Use nullable foreign keys where appropriate to avoid DEFAULT value issues +- Alternatively, ensure DEFAULT values for foreign key columns exist in their referenced tables + +**Testing and Validation** +- Test synchronization scenarios with foreign key constraints enabled +- Monitor for constraint violations during sync operations in development + +### Trigger Compatibility + +Be aware that certain types of triggers can cause errors during synchronization due to SQLite Sync's merge logic. + +**Duplicate Operations** +- If a trigger modifies a table that is also synchronized with SQLite Sync, changes performed by the trigger may be applied twice during the merge operation +- This can lead to constraint violations or unexpected data states depending on the table's constraints + +**Column-by-Column Processing** +- SQLite Sync applies changes column-by-column during synchronization +- UPDATE triggers may be called multiple times for a single row as each column is processed +- This can result in unexpected trigger behavior \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md new file mode 100644 index 0000000..253ae61 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md @@ -0,0 +1,120 @@ +# Getting Started + +Here's a quick example to get started with SQLite Sync: + +### Prerequisites + +1. **SQLite Cloud Account**: Sign up at [SQLite Cloud](https://sqlitecloud.io/) +2. **SQLite Sync Extension**: Download from [Releases](https://github.com/sqliteai/sqlite-sync/releases) + +### SQLite Cloud Setup + +1. Create a new project and database in your [SQLite Cloud Dashboard](https://dashboard.sqlitecloud.io/) +2. Copy your connection string and API key from the dashboard +3. Create tables with identical schema in both local and cloud databases +4. [Enable synchronization](https://docs.sqlitecloud.io/docs/offsync#:~:text=in%20the%20cloud.-,Configuring%20OffSync,-You%20can%20enable): go to Databases > Offsync page and select each table you want to synchronize in your database + +### Local Database Setup + +```bash +# Start SQLite CLI +sqlite3 myapp.db +``` + +```sql +-- Load the extension +.load ./cloudsync + +-- Create a table (primary key MUST be TEXT for global uniqueness) +CREATE TABLE IF NOT EXISTS my_data ( + id TEXT PRIMARY KEY NOT NULL, + value TEXT NOT NULL DEFAULT '', + created_at TEXT DEFAULT CURRENT_TIMESTAMP +); + +-- Initialize table for synchronization +SELECT cloudsync_init('my_data'); + +-- Use your local database normally: read and write data using standard SQL queries +-- The CRDT system automatically tracks all changes for synchronization + +-- Example: Insert data (always use cloudsync_uuid() for globally unique IDs) +INSERT INTO my_data (id, value) VALUES + (cloudsync_uuid(), 'Hello from device A!'), + (cloudsync_uuid(), 'Working offline is seamless!'); + +-- Example: Update and delete operations work normally +UPDATE my_data SET value = 'Updated: Hello from device A!' WHERE value LIKE 'Hello from device A!'; + +-- View your data +SELECT * FROM my_data ORDER BY created_at; + +-- Configure network connection before using the network sync functions +SELECT cloudsync_network_init('sqlitecloud://your-project-id.sqlite.cloud/database.sqlite'); +SELECT cloudsync_network_set_apikey('your-api-key-here'); +-- Or use token authentication (required for Row-Level Security) +-- SELECT cloudsync_network_set_token('your_auth_token'); + +-- Sync with cloud: send local changes, then check the remote server for new changes +-- and, if a package with changes is ready to be downloaded, applies them to the local database +SELECT cloudsync_network_sync(); +-- Keep calling periodically. The function returns > 0 if data was received +-- In production applications, you would typically call this periodically +-- rather than manually (e.g., every few seconds) +SELECT cloudsync_network_sync(); + +-- Before closing the database connection +SELECT cloudsync_terminate(); +-- Close the database connection +.quit +``` + +```sql +-- On another device (or create another database for testing: sqlite3 myapp_2.db) +-- Follow the same setup steps: load extension, create table, init sync, configure network + +-- Load extension and create identical table structure +.load ./cloudsync +CREATE TABLE IF NOT EXISTS my_data ( + id TEXT PRIMARY KEY NOT NULL, + value TEXT NOT NULL DEFAULT '', + created_at TEXT DEFAULT CURRENT_TIMESTAMP +); +SELECT cloudsync_init('my_data'); + +-- Connect to the same cloud database +SELECT cloudsync_network_init('sqlitecloud://your-project-id.sqlite.cloud/database.sqlite'); +SELECT cloudsync_network_set_apikey('your-api-key-here'); + +-- Sync to get data from the first device +SELECT cloudsync_network_sync(); +-- repeat until data is received (returns > 0) +SELECT cloudsync_network_sync(); + +-- View synchronized data +SELECT * FROM my_data ORDER BY created_at; + +-- Add data from this device to test bidirectional sync +INSERT INTO my_data (id, value) VALUES + (cloudsync_uuid(), 'Hello from device B!'); + +-- Sync again to send this device's changes +SELECT cloudsync_network_sync(); + +-- The CRDT system ensures all devices eventually have the same data, +-- with automatic conflict resolution and no data loss + +-- Before closing the database connection +SELECT cloudsync_terminate(); +-- Close the database connection +.quit +``` + +### For a Complete Example + +See the [examples](https://github.com/sqliteai/sqlite-sync/blob/main/examples/simple-todo-db/README.md) directory for a comprehensive walkthrough including: + +- Multi-device collaboration +- Offline scenarios +- Row-level security setup +- Conflict resolution demonstrations diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md new file mode 100644 index 0000000..8dcc8c1 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md @@ -0,0 +1,98 @@ +--- +title: SQLite-Sync +description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +category: platform +status: publish +slug: sqlite-sync +--- + +# Introduction to SQLite Sync + +[SQLite Sync](https://github.com/sqliteai/sqlite-sync) is a multi-platform extension that brings a true **local-first experience** to your applications with minimal effort. It extends standard SQLite tables with built-in support for offline work and automatic synchronization, allowing multiple devices to operate independently—even without a network connection—and seamlessly stay in sync. With SQLite Sync, developers can easily build **distributed, collaborative applications** while continuing to rely on the **simplicity, reliability, and performance of SQLite**. + +Under the hood, SQLite Sync uses advanced **CRDT (Conflict-free Replicated Data Type)** algorithms and data structures designed specifically for **collaborative, distributed systems**. This means: + +- Devices can update data independently, even without a network connection. +- When they reconnect, all changes are **merged automatically and without conflicts**. +- **No data loss. No overwrites. No manual conflict resolution.** + +In simple terms, CRDTs make it possible for multiple users to **edit shared data at the same time**, from anywhere, and everything just works. + +## Key Features + +- **Offline-First by Design**: Works seamlessly even when devices are offline. Changes are queued locally and synced automatically when connectivity is restored. +- **CRDT-Based Conflict Resolution**: Merges updates deterministically and efficiently, ensuring eventual consistency across all replicas without the need for complex merge logic. +- **Embedded Network Layer**: No external libraries or sync servers required. SQLiteSync handles connection setup, message encoding, retries, and state reconciliation internally. +- **Drop-in Simplicity**: Just load the extension into SQLite and start syncing. No need to implement custom protocols or state machines. +- **Efficient and Resilient**: Optimized binary encoding, automatic batching, and robust retry logic make synchronization fast and reliable even on flaky networks. + +Whether you're building a mobile app, IoT device, or desktop tool, SQLite Sync simplifies distributed data management and unlocks the full potential of SQLite in decentralized environments. + +## Built-in Network Layer + +Unlike traditional sync systems that require you to build and maintain a complex backend, **SQLite Sync includes a built-in network layer** that works out of the box: + +- Sync your database with the cloud using **a single function call**. +- Compatible with **any language or framework** that supports SQLite. +- **No backend setup required** — SQLite Sync handles networking, change tracking, and conflict resolution for you. + +The sync layer is tightly integrated with [**SQLite Cloud**](https://sqlitecloud.io/), enabling seamless and secure data sharing across devices, users, and platforms. You get the power of cloud sync without the complexity. + +## Row-Level Security + +Thanks to the underlying SQLite Cloud infrastructure, **SQLite Sync supports Row-Level Security (RLS)**—allowing you to define **precise access control at the row level**: + +- Control not just who can read or write a table, but **which specific rows** they can access. +- Enforce security policies on the server—no need for client-side filtering. + +For example: + +- User A can only see and edit their own data. +- User B can access a different set of rows—even within the same shared table. + +**Benefits of RLS**: + +- **Data isolation**: Ensure users only access what they’re authorized to see. +- **Built-in privacy**: Security policies are enforced at the database level. +- **Simplified development**: Reduce or eliminate complex permission logic in your application code. + +## What Can You Build with SQLite Sync? + +SQLite Sync is ideal for building collaborative and distributed apps across web, mobile, desktop, and edge platforms. Some example use cases include: + +#### 📋 Productivity & Collaboration + +- **Shared To-Do Lists**: Users independently update tasks and sync effortlessly. +- **Note-Taking Apps**: Real-time collaboration with offline editing. +- **Markdown Editors**: Work offline, sync when back online—no conflicts. + +#### 📱 Mobile & Edge + +- **Field Data Collection**: For remote inspections, agriculture, or surveys. +- **Point-of-Sale Systems**: Offline-first retail solutions with synced inventory. +- **Health & Fitness Apps**: Sync data across devices with strong privacy controls. + +#### 🏢 Enterprise Workflows + +- **CRM Systems**: Sync leads and clients per user with row-level access control. +- **Project Management Tools**: Offline-friendly planning and task management. +- **Expense Trackers**: Sync team expenses securely and automatically. + +#### 🧠 Personal Apps + +- **Journaling & Diaries**: Private, encrypted entries that sync across devices. +- **Bookmarks & Reading Lists**: Personal or collaborative content management. +- **Habit Trackers**: Sync progress with data security and consistency. + +#### 🌍 Multi-User, Multi-Tenant Systems + +- **SaaS Platforms**: Row-level access for each user or team. +- **Collaborative Design Tools**: Merge visual edits and annotations offline. +- **Educational Apps**: Shared learning content with per-student access controls. + +## Integrations + +Use SQLite-Sync alongside: +- **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** – on-device inference, embedding generation, and model interaction directly into your database +- **[SQLite-Vector](https://github.com/sqliteai/sqlite-vector)** – vector search from SQL +- **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** – define SQLite functions in JavaScript diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md new file mode 100644 index 0000000..3b6f179 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -0,0 +1,156 @@ +# Android Quick Start Guide + +This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. + +This example uses the [requery:sqlite-android](https://github.com/requery/sqlite-android) library, but other options include building a custom SQLite with extension support or using other third-party SQLite libraries that enable extension loading. + +### 1. Add Dependencies + +In your `app/build.gradle.kts`: + +```kotlin +dependencies { + implementation("com.github.requery:sqlite-android:3.49.0") +} +``` + +### 2. Bundle the Extension + +1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +2. Download your preferred .zip architecture releases: + - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) + - x86_64 - 64-bit x86 emulators and Intel-based devices +3. Extract and place the `cloudsync.so` file in: `app/src/main/assets/lib/cloudsync.so` + +### 3. Basic Integration + +Here’s a complete example showing how to load the extension, create a table, initialize CloudSync, and perform network sync. + +```kotlin +import android.content.Context +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.lifecycle.lifecycleScope +import io.requery.android.database.sqlite.SQLiteCustomExtension +import io.requery.android.database.sqlite.SQLiteCustomFunction +import io.requery.android.database.sqlite.SQLiteDatabase +import io.requery.android.database.sqlite.SQLiteDatabaseConfiguration +import io.requery.android.database.sqlite.SQLiteFunction +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.io.File +import java.io.FileOutputStream + +class MainActivity : ComponentActivity() { + private fun copyExtensionToFilesDir(context: Context): File { + val assetManager = context.assets + val inputStream = assetManager.open("lib/cloudsync.so") + + val outFile = File(context.filesDir, "cloudsync.so") + inputStream.use { input -> + FileOutputStream(outFile).use { output -> + input.copyTo(output) + } + } + return outFile + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // --- Copy extension from assets to filesystem --- + val extensionFile = copyExtensionToFilesDir(this) + val extensionPath = extensionFile.absolutePath + + // --- Create extension configuration --- + val cloudSyncExtension = SQLiteCustomExtension(extensionPath, null) + + // --- Configure database with extension --- + val config = SQLiteDatabaseConfiguration( + "${filesDir.path}/database_name.db", + SQLiteDatabase.CREATE_IF_NECESSARY or SQLiteDatabase.OPEN_READWRITE, + emptyList(), + emptyList(), + listOf(cloudSyncExtension) + ) + + // --- Open database --- + val db = SQLiteDatabase.openDatabase(config, null, null) + val tableName = "table_name" + + lifecycleScope.launch { + withContext(Dispatchers.IO) { + // --- Check CloudSync version --- + val version = db.rawQuery("SELECT cloudsync_version();", null).use { cursor -> + if (cursor.moveToFirst()) cursor.getString(0) else null + } + + if (version == null) { + println("CLOUDSYNC-TEST: Failed to load SQLite Sync extension") + return@withContext + } + + println("CLOUDSYNC-TEST: SQLite Sync loaded successfully. Version: $version") + + try { + // --- Create test table --- + val createTableSQL = """ + CREATE TABLE IF NOT EXISTS $tableName ( + id TEXT PRIMARY KEY NOT NULL, + value TEXT NOT NULL DEFAULT '', + created_at TEXT DEFAULT CURRENT_TIMESTAMP + ); + """.trimIndent() + db.execSQL(createTableSQL) + + // --- Initialize CloudSync for table --- + val initResult = db.rawQuery("SELECT cloudsync_init('$tableName');", null).use { it.moveToFirst() } + + // --- Insert sample data --- + db.execSQL(""" + INSERT INTO $tableName (id, value) VALUES + (cloudsync_uuid(), 'test1'), + (cloudsync_uuid(), 'test2'); + """.trimIndent()) + + // --- Initialize network connection --- + db.rawQuery("SELECT cloudsync_network_init('');", null).use { it.moveToFirst() } + + // --- Set API key --- + db.rawQuery( "SELECT cloudsync_network_set_apikey('');", null).use { it.moveToFirst() } + + // --- Run network sync multiple times --- + // Note: cloudsync_network_sync() returns > 0 if data was sent/received. + // It should ideally be called periodically to ensure both sending local + // changes and receiving remote changes work reliably. + repeat(2) { attempt -> + try { + val syncResult = db.rawQuery("SELECT cloudsync_network_sync();", null).use { cursor -> + if (cursor.moveToFirst()) cursor.getInt(0) else 0 + } + println("CLOUDSYNC-TEST: Network sync attempt ${attempt + 1}: result = $syncResult") + } catch (e: Exception) { + println("CLOUDSYNC-TEST: Sync attempt ${attempt + 1} failed: ${e.message}") + } + } + } catch (e: Exception) { + println("CLOUDSYNC-TEST: Error - ${e.message}") + } finally { + // --- Terminate CloudSync --- + db.rawQuery("SELECT cloudsync_terminate();", null).use { it.moveToFirst() } + + // Close the database + db.close() + } + } + } + } +} +``` + +### 4. Notes on SQLite Usage in Android + +CloudSync functions must be executed with `SELECT`. In Android, use `rawQuery()` to call them, and always call `moveToFirst()` (or `moveToNext()`) on the cursor to ensure the query actually executes. + +For detailed SQLite Sync API documentation, see the main [documentation](https://github.com/sqliteai/sqlite-sync/blob/main/README.md). diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md new file mode 100644 index 0000000..cad4a1c --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md @@ -0,0 +1,202 @@ +# IOS Quick Start Guide + +This guide will walk you through setting up SQLite in Swift to load CloudsSync extensions. + +## 1. Create a New Swift Project + +1. Open Xcode +2. Create a new project +3. Select **Multiplatform** → **App** + +## 2. Download and Add CloudSync Framework + +1. Download the latest version of `cloudsync-apple-xcframework` from: + https://github.com/sqliteai/sqlite-sync/releases + +2. In Xcode, click on your project name in the source tree (top left with the Xcode logo) + +3. In the new tab that opens, navigate to the left column under the **Targets** section and click on the first target + +4. You should now be in the **General** tab. Scroll down to **"Frameworks, Libraries, and Embedded Content"** + +5. Click the **+** button → **Add Other...** → **Add Files...** + +6. Select the downloaded `CloudSync.xcframework` folder + +7. Switch to the **Build Phases** tab and verify that `CloudSync.xcframework` appears under **Embedded Frameworks** + +## 3. Handle Security Permissions (macOS) + +When you return to the main ContentView file, you may encounter an Apple security error: + +1. Click **Done** when the security dialog appears +2. Open **System Settings** → **Privacy & Security** +3. Scroll to the bottom and find the message "Mac blocked CloudSync" +4. Click **Allow Anyway** +5. Close and reopen ContentView in Xcode +6. The same error should appear but now with a third button **Open Anyway** - click it +7. If errors persist, try reopening and closing ContentView multiple times or repeat the security steps above + +## 4. Set Up SQLite with Extension Loading + +You need a version of SQLite that supports loading extensions. You have two options: + +### Option A: Download SQLite Amalgamation (Recommended) + +1. Download the amalgamation from: https://sqlite.org/download.html +2. Create a new folder called **SQLite** in your Swift project in Xcode +3. Copy `sqlite3.c` and `sqlite3.h` into this folder by dragging them in +4. Enable all targets and confirm + +### Option B: Use CocoaPods + +## 5. Configure Objective-C Bridging Header + +1. When you add the SQLite files, a popup will appear asking **"Would you like to configure an Objective-C bridging header?"** +2. Click **Create Bridging Header** +3. In the newly created bridging header file, import the SQLite headers: + ```objc + #import "sqlite3.h" + ``` + +## 6. Test the Setup + +To verify that the extension loads correctly in your Swift project, replace your ContentView.swift content with this test code: + +```swift +import SwiftUI + +struct ContentView: View { + @State private var statusLines: [String] = [] + private var statusText: String { statusLines.joined(separator: "\n") } + + var body: some View { + VStack(spacing: 12) { + Image(systemName: "globe") + .imageScale(.large) + .foregroundStyle(.tint) + Text("Hello, world!") + + Divider() + + Text("Status") + .font(.headline) + + ScrollView { + Text(statusText.isEmpty ? "No status yet." : statusText) + .font(.system(.footnote, design: .monospaced)) + .frame(maxWidth: .infinity, alignment: .leading) + .textSelection(.enabled) + .padding(.vertical, 4) + } + .frame(maxHeight: 260) + } + .padding() + .task { + log("Starting...") + var db: OpaquePointer? + + // Open an in-memory database just for demonstrating status updates. + // Replace with your own URL/path if needed. + var rc = sqlite3_open(":memory:", &db) + if rc != SQLITE_OK { + let msg = db.flatMap { sqlite3_errmsg($0) }.map { String(cString: $0) } ?? "Unknown error" + log("sqlite3_open failed (\(rc)): \(msg)") + if let db { sqlite3_close(db) } + return + } + log("Database opened.") + + // Enable loadable extensions + rc = sqlite3_enable_load_extension(db, 1) + log("sqlite3_enable_load_extension rc=\(rc)") + + // Locate the extension in the bundle (adjust as needed) + let vendorBundle = Bundle(identifier: "ai.sqlite.cloudsync") + let candidatePaths: [String?] = [ + vendorBundle?.path(forResource: "CloudSync", ofType: "dylib"), + vendorBundle?.path(forResource: "CloudSync", ofType: ""), + Bundle.main.path(forResource: "CloudSync", ofType: "dylib"), + Bundle.main.path(forResource: "CloudSync", ofType: "") + ] + let cloudsyncPath = candidatePaths.compactMap { $0 }.first + log("cloudsyncPath: \(cloudsyncPath ?? "Not found")") + + var loaded = false + if let path = cloudsyncPath { + var errMsg: UnsafeMutablePointer? = nil + rc = sqlite3_load_extension(db, path, nil, &errMsg) + if rc != SQLITE_OK { + let message = errMsg.map { String(cString: $0) } ?? String(cString: sqlite3_errmsg(db)) + if let e = errMsg { sqlite3_free(e) } + log("sqlite3_load_extension failed rc=\(rc): \(message)") + } else { + loaded = true + log("sqlite3_load_extension succeeded.") + } + + // Optionally disable further extension loading + _ = sqlite3_enable_load_extension(db, 0) + } else { + log("Skipping load: extension file not found in bundle.") + } + + // Run SELECT cloudsync_version() and log the result + if loaded { + let sql = "SELECT cloudsync_version()" + log("Running query: \(sql)") + var stmt: OpaquePointer? + rc = sqlite3_prepare_v2(db, sql, -1, &stmt, nil) + if rc != SQLITE_OK { + let msg = String(cString: sqlite3_errmsg(db)) + log("sqlite3_prepare_v2 failed (\(rc)): \(msg)") + } else { + defer { sqlite3_finalize(stmt) } + rc = sqlite3_step(stmt) + if rc == SQLITE_ROW { + if let cstr = sqlite3_column_text(stmt, 0) { + let version = String(cString: cstr) + log("cloudsync_version(): \(version)") + } else { + log("cloudsync_version(): (null)") + } + } else if rc == SQLITE_DONE { + log("cloudsync_version() returned no rows") + } else { + let msg = String(cString: sqlite3_errmsg(db)) + log("sqlite3_step failed (\(rc)): \(msg)") + } + } + } else { + log("Extension not loaded; skipping cloudsync_version() query.") + } + + if let db { sqlite3_close(db) } + log("Done.") + } + } + + @MainActor + private func log(_ line: String) { + statusLines.append(line) + } +} + +#Preview { + ContentView() +} +``` + +## Expected Results + +When you run the test app, you should see status messages in the UI indicating: + +- Database connection success +- Extension loading status +- CloudSync version information (if successfully loaded) + +This confirms that CloudSync is properly integrated and functional in your Swift project. + +## Usage Example + +Check out the [Swift Multiplatform app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/swift-multiplatform-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md new file mode 100644 index 0000000..b302d07 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md @@ -0,0 +1,60 @@ +## Linux Quick Start + +SQLite on Linux supports dynamic extension loading via `.so` shared libraries. + +This guide walks through how to load an extension named `cloudsync.so` on common Linux distributions via SQLite3 Command Line. + +--- + +## 1. Install SQLite (Per Distribution) + +### Ubuntu / Debian + +```bash +sudo apt install sqlite3 +``` + +### Fedora + +```bash +sudo dnf install sqlite +``` + +### Arch Linux + +```bash +pacman -Sy sqlite3 +``` + +### Alpine Linux + +```bash +apk add sqlite +``` + +## 2. Download the Extension + +Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) and download the extension. + +> For Alpine Linux: ensure to download the extension specifically for `musl-x86_64` or `musl-arm64` targets. + +## 3. Load Extension from CLI + +```bash +sqlite3 +``` + +```sql +.load ./cloudsync.so +SELECT cloudsync_version(); +``` + +--- + +## Troubleshooting + +| Problem | Solution | +| -------------------------------------------- | ----------------------------------------------------------------- | +| `no such file or directory` | Ensure path to `.so` is correct and matches your platform. | +| `incompatible architecture` | Download extension for your Linux system (e.g., x86_64 vs arm64). | +| `Failed to load extension: symbol not found` | Download the extension for `musl-x86_64` or `musl-arm64` targets | diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md new file mode 100644 index 0000000..fc9ea90 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md @@ -0,0 +1,101 @@ +# MacOS Quick Start Guide + +This guide explains how to install SQLite on macOS with support for loading extensions. + +## macOS and xcframework + +On recent versions of macOS, the recommended way to load a SQLite extension is through the [.xcframework](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/platforms/ios.md) approach, the same method used on iOS. + +## macOS and dylib + +On macOS, dynamic libraries (`.dylib`) can be loaded at runtime using SQLite’s `sqlite3_load_extension` API. + +### Step 1: Add Bridging Header (if using Swift only) + +Create a `bridging-header.h` file: + +```c +#include +``` + +Set it in your Xcode project under **Build Settings → Objective-C Bridging Header**. + +### Step 2: Swift Code to Load Extension + +```swift +import Foundation +import SQLite3 + +let dbPath = ":memory:" // or a real file path +var db: OpaquePointer? + +if sqlite3_open(dbPath, &db) != SQLITE_OK { + fatalError("Failed to open database") +} + +// Enable loading extensions +if sqlite3_enable_load_extension(db, 1) != SQLITE_OK { + let err = String(cString: sqlite3_errmsg(db)) + fatalError("Enable extension loading failed: \(err)") +} + +// Load the extension +let extensionPath = Bundle.main.path(forResource: "my_extension", ofType: "dylib")! +if sqlite3_load_extension(db, extensionPath, nil, nil) != SQLITE_OK { + let err = String(cString: sqlite3_errmsg(db)) + fatalError("Extension loading failed: \(err)") +} + +print("Extension loaded successfully.") +``` + +> ⚠️ Gatekeeper may block unsigned `.dylib` files. You might need to codesign or use `spctl --add`. + +## Python on macOS + +The default Python on macOS doesn't support loading SQLite extensions. +Install Python from the [official package](https://www.python.org/downloads/macos/) or use Homebrew Python instead: + +```bash +brew install python +``` + +Verify that you are using the Homebrew-installed `python3` by running: + +```bash +which python3 + +# /opt/homebrew/bin/python3 +``` + +After installing Python with Homebrew, the `python` command now uses the Homebrew version. +You can now load SQLite extensions in Python as shown here. + +``` +import sqlite3 +import os + +# Path to your compiled extension (.dylib for macOS/iOS) +EXTENSION_PATH = os.path.abspath("cloudsync") + +# Connect to SQLite and enable extension loading +conn = sqlite3.connect(":memory:") +conn.enable_load_extension(True) + +# Load the extension +try: + conn.load_extension(EXTENSION_PATH) + print("Extension loaded successfully.") +except sqlite3.OperationalError as e: + print(f"Failed to load extension: {e}") + +conn.enable_load_extension(False) + +# Optionally test it (e.g., call a custom SQL function) +cursor = conn.execute("SELECT cloudsync_version();") +print(cursor.fetchone()) +``` + +## Usage Example + +Check out the [Swift Multiplatform app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/swift-multiplatform-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md new file mode 100644 index 0000000..3778e4f --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md @@ -0,0 +1,163 @@ +# React Native - Expo Quick Start Guide + +This guide shows how to integrate CloudSync extensions in Expo and React Native applications using OP-SQLite. + +## Getting Started + +Before setting up SQLite extensions, you'll need to create and initialize your project: + +### Create a New Expo Project + +```bash +# Create a new project +npx create-expo-app MyApp + +# Or use our pre-configured template with SQLite extensions +npx create-expo-app MyApp --template @sqliteai/todoapp +``` + +### Initialize for Native Code + +Since SQLite extensions require native code, you must initialize your project: + +```bash +cd MyApp +npx expo prebuild +``` + +> **Important**: This setup requires native code generation. Run `npx expo prebuild` after any changes to native dependencies or extension files. + +## Android Setup + +### Step 1: Download Android Extension + +1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +2. Download your preferred .zip architecture releases: + - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) + - x86_64 - 64-bit x86 emulators and Intel-based devices + +### Step 2: Place Extension Files + +Extract the `.so` files in the following directory structure: + +``` +/android + /app + /src + /main + /jniLibs + /arm64-v8a + cloudsync.so + /x86_64 + cloudsync.so +``` + +> **Note:** Create the `jniLibs` directory structure if it doesn't exist. + +## iOS Setup + +### Step 1: Download iOS Extension + +1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +2. Download the `cloudsync-apple-xcframework-*.zip` +3. Extract `CloudSync.xcframework` + +### Step 2: Add Framework to Project + +1. Place the framework in your project: + + ``` + /ios + /[app-name] + /Frameworks + /CloudSync.xcframework + ``` + +2. **Open Xcode:** + + - Open Existing Project → Select your Expo app's `ios` folder + - Click on your app name (top left, with Xcode logo) + +3. **Configure Target:** + + - Go to **Targets** → **[app-name]** → **General** tab + - Scroll down to **"Frameworks, Libraries, and Embedded Content"** + - Click **"+"** → **"Add Other…"** → **"Add Files…"** + - Select `/ios/[app-name]/Frameworks/CloudSync.xcframework` + +4. **Set Embed Options:** + + - Ensure the **"Embed"** column shows either: + - **"Embed & Sign"** (recommended) + - **"Embed Without Signing"** + +5. **Verify Build Phases:** + + - Go to **"Build Phases"** tab + - Check that **"Embed Frameworks"** section contains **CloudSync** + +6. Close Xcode + +## Install OP-SQLite + +### For React Native: + +```bash +npm install @op-engineering/op-sqlite +npx pod-install +``` + +### For Expo: + +```bash +npx expo install @op-engineering/op-sqlite +npx expo prebuild +``` + +## Implementation + +### Basic Setup + +```javascript +import { getDylibPath, open } from "@op-engineering/op-sqlite"; +import { Platform } from "react-native"; + +// Open database connection +const db = open({ name: "to-do-app" }); +``` + +### Load Extension + +```javascript +const loadCloudSyncExtension = async () => { + let extensionPath; + + console.log("Loading CloudSync extension..."); + + try { + if (Platform.OS === "ios") { + extensionPath = getDylibPath("ai.sqlite.cloudsync", "CloudSync"); + } else { + extensionPath = "cloudsync"; + } + + // Load the extension + db.loadExtension(extensionPath); + + // Verify extension loaded successfully + const version = await db.execute("SELECT cloudsync_version();"); + console.log( + `CloudSync extension loaded successfully, version: ${version.rows[0]["cloudsync_version()"]}` + ); + + return true; + } catch (error) { + console.error("Error loading CloudSync extension:", error); + return false; + } +}; +``` + +## Usage Example + +Check out the [Expo to-do-app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/to-do-app) for comprehensive usage examples and best practices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md new file mode 100644 index 0000000..3a0e13e --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md @@ -0,0 +1,94 @@ +# WASM Quick Start Guide + +1. Install the WebAssembly (WASM) version of SQLite with the SQLite Sync extension enabled from npm: + + ``` + npm install @sqliteai/sqlite-wasm + ``` + +2. Create an HTML file that imports the SQLite WASM module using an import map and references the JavaScript loader: + + ``` + + + + + + SQLite WASM Extension Example + + +

    SQLite WASM with SQLite Sync Example

    +

    Open the directory in the terminal and type: npx serve .

    +

    Check the browser console for output.

    + + + + + + ``` + +3. Create the JavaScript file (load_extension.js) that initializes the SQLite WASM worker and verifies the extension is loaded: + + ``` + /** + * This example uses the package `@sqliteai/sqlite-wasm`. + * This version of SQLite WASM is bundled with SQLite Sync and SQLite Vector extensions. + * Extensions cannot be loaded at runtime in the browser environment. + * + * Run: `npx serve .` + */ + + import { sqlite3Worker1Promiser } from '@sqliteai/sqlite-wasm'; + + const log = console.log; + const error = console.error; + + const initializeSQLite = async () => { + try { + log('Loading and initializing SQLite3 module with sqlite-sync extension...'); + + const promiser = await new Promise((resolve) => { + const _promiser = sqlite3Worker1Promiser({ + onready: () => resolve(_promiser), + }); + }); + + const configResponse = await promiser('config-get', {}); + log('Running SQLite3 version', configResponse.result.version.libVersion); + + const openResponse = await promiser('open', { + filename: 'file:mydb.sqlite3', + }); + const { dbId } = openResponse; + + await promiser('exec', { + dbId, + sql: 'SELECT cloudsync_version();', // or vector_version() + callback: (result) => { + if (!result.row) { + return; + } + log('Include SQLite Sync version: ', result.row[0]); + } + }); + + } catch (err) { + if (!(err instanceof Error)) { + err = new Error(err.result.message); + } + error(err.name, err.message); + } + }; + + initializeSQLite(); + ``` + +## Usage Example + +Check out the [React/Vite app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/sport-tracker-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md new file mode 100644 index 0000000..f9625f1 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -0,0 +1,213 @@ +## Windows Quick Start + +This guide explains how to install SQLite on Windows with support for loading extensions. + +## Using SQLite with Python + +1. **Download Python** + Get the latest Python for Windows from [python.org](https://www.python.org/downloads/windows/). + +2. **Install Python** + + - Run the installer. + - Make sure to check **"Add Python to PATH"**. + - SQLite comes bundled with Python, no extra steps needed. + +3. **Check your installation** + Open Command Prompt and run: + + ```bash + python --version + python -c "import sqlite3; print('SQLite version:', sqlite3.sqlite_version)" + ``` + +4. **Download the Extension** + Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) and download the extension. + +5. **Load Extension** + + ``` + import sqlite3 + import os + + # Path to your compiled extension (.dll for Windows) + EXTENSION_PATH = os.path.abspath("cloudsync") + + # Connect to SQLite and enable extension loading + conn = sqlite3.connect(":memory:") + conn.enable_load_extension(True) + + # Load the extension + try: + conn.load_extension(EXTENSION_PATH) + print("Extension loaded successfully.") + except sqlite3.OperationalError as e: + print(f"Failed to load extension: {e}") + + conn.enable_load_extension(False) + + # Optionally test it (e.g., call a custom SQL function) + cursor = conn.execute("SELECT cloudsync_version();") + print(cursor.fetchone()) + ``` + +## Using SQLite with C# + +This guide shows how to load a native SQLite extension (e.g., **`cloudsync.dll`**) from a C# app on **Windows** using **`Microsoft.Data.Sqlite`**. + +### Prerequisites + +- Windows x64 +- .NET 6+ SDK +- [NuGet package manager](https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools?tabs=windows) +- The native extension file: `cloudsync.dll` (x64 build) - download from [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) + +> **Important:** Your app, `e_sqlite3.dll` (bundled by `Microsoft.Data.Sqlite`), and `cloudsync.dll` must all be the **same architecture** (typically x64). + +--- + +### 1. Install the SQLite package + +Install the [`Microsoft.Data.Sqlite`](https://www.nuget.org/packages/Microsoft.Data.Sqlite) NuGet package: +```bash +dotnet add package Microsoft.Data.Sqlite +``` + +### 2. Set up your project structure + +Place `cloudsync.dll` in your project and configure it to copy to the output folder. + +Example directory structure: +``` +MyApp/ + Program.cs + Native/ + cloudsync.dll + MyApp.csproj +``` + +Configure your `MyApp.csproj` file: +```xml + + + Exe + net8.0 + enable + enable + + + + + + + + + + PreserveNewest + + + +``` + +### 3. Load the extension in your code + +Create your `Program.cs` file to initialize SQLite and load the extension: +```csharp +using System; +using Microsoft.Data.Sqlite; + +class Program +{ + static void Main() + { + // Configure the database connection + var cs = new SqliteConnectionStringBuilder + { + DataSource = "example.db", + Mode = SqliteOpenMode.ReadWriteCreate + }.ToString(); + + using var conn = new SqliteConnection(cs); + conn.Open(); + + // Enable extension loading + conn.EnableExtensions(); + + // Load the native extension (DLL must be next to the EXE or on PATH) + // You can pass an absolute path if you prefer + conn.LoadExtension("cloudsync"); + + // Verify SQLite is working + using var cmd = conn.CreateCommand(); + cmd.CommandText = "SELECT sqlite_version();"; + Console.WriteLine("SQLite version: " + cmd.ExecuteScalar()); + + // Verify the extension is loaded + cmd.CommandText = "SELECT cloudsync_version();"; + Console.WriteLine("cloudsync_version(): " + cmd.ExecuteScalar()); + } +} +``` + +### 4. Run your application + +Build and run your application: +```bash +dotnet build +dotnet run +``` + +You should see output similar to: +``` +SQLite version: 3.45.0 +cloudsync_version(): 1.0.0 +``` + +#### Extension search locations + +SQLite searches for extensions in this order: + +1. Process working directory +2. Application base directory (where your .exe lives) +3. PATH environment variable directories +4. Full path provided to `LoadExtension(...)` + +> **Tip:** For most apps, simply copying the DLL to the output folder (next to your .exe) is sufficient. + +--- + +### Common issues and solutions + +**SqliteException: not authorized** + +- **Cause:** Extension loading not enabled +- **Fix:** Call `conn.EnableExtensions()` before loading + +**SqliteException: The specified module could not be found** + +- **Cause:** DLL not in search path or missing dependencies +- **Fix:** Place DLL next to .exe, use absolute path, or ensure dependencies are available + +**BadImageFormatException** + +- **Cause:** Architecture mismatch (e.g., mixing x86 and x64) +- **Fix:** Ensure app, `e_sqlite3.dll`, and `cloudsync.dll` are all the same architecture + +**EntryPointNotFoundException** + +- **Cause:** DLL is not a valid SQLite extension +- **Fix:** Verify the extension exports `sqlite3_extension_init` + +**Windows "blocked" DLL** + +- **Cause:** Downloaded DLL is blocked by Windows +- **Fix:** Right-click → Properties → Check "Unblock" → OK + +--- + +### Deployment + +When publishing your app, ensure the extension is included: +```bash +dotnet publish -c Release -r win-x64 --self-contained false +``` From e8b797f7da23652f79bc7cdb7d013bc822372ffb Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Tue, 30 Sep 2025 16:32:12 +0200 Subject: [PATCH 158/185] chore: add frontmatter --- .../api-reference/cloudsync_begin_alter.md | 8 ++++++++ .../api-reference/cloudsync_cleanup.md | 10 +++++++++- .../api-reference/cloudsync_commit_alter.md | 8 ++++++++ .../api-reference/cloudsync_db_version.md | 8 ++++++++ .../api-reference/cloudsync_disable.md | 8 ++++++++ .../api-reference/cloudsync_enable.md | 8 ++++++++ .../sqlite-sync/api-reference/cloudsync_init.md | 10 +++++++++- .../api-reference/cloudsync_is_enabled.md | 8 ++++++++ .../cloudsync_network_check_changes.md | 10 +++++++++- .../api-reference/cloudsync_network_cleanup.md | 8 ++++++++ .../cloudsync_network_has_unsent_changes.md | 8 ++++++++ .../api-reference/cloudsync_network_init.md | 8 ++++++++ .../api-reference/cloudsync_network_logout.md | 8 ++++++++ .../cloudsync_network_reset_sync_version.md | 8 ++++++++ .../cloudsync_network_send_changes.md | 10 ++++++++-- .../cloudsync_network_set_apikey.md | 8 ++++++++ .../cloudsync_network_set_token.md | 10 +++++++++- .../api-reference/cloudsync_network_sync.md | 10 ++++++++-- .../api-reference/cloudsync_siteid.md | 8 ++++++++ .../api-reference/cloudsync_terminate.md | 8 ++++++++ .../sqlite-sync/api-reference/cloudsync_uuid.md | 8 ++++++++ .../api-reference/cloudsync_version.md | 8 ++++++++ .../sqlite-ai/sqlite-sync/best-practices.md | 17 +++++++++++++++-- .../sqlite-ai/sqlite-sync/getting-started.md | 10 +++++++++- .../sqlite-ai/sqlite-sync/introduction.md | 7 ++++--- .../sqlite-sync/quick-starts/android.md | 12 ++++++++++-- .../sqlite-ai/sqlite-sync/quick-starts/ios.md | 8 ++++++++ .../sqlite-ai/sqlite-sync/quick-starts/linux.md | 8 ++++++++ .../sqlite-ai/sqlite-sync/quick-starts/macos.md | 8 ++++++++ .../quick-starts/react-native-expo.md | 8 ++++++++ .../sqlite-ai/sqlite-sync/quick-starts/wasm.md | 8 ++++++++ .../sqlite-sync/quick-starts/windows.md | 15 +++++++++++++++ 32 files changed, 273 insertions(+), 16 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md index 9f80884..1821c9c 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_begin_alter +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-begin-alter +--- + ### `cloudsync_begin_alter(table_name)` **Description:** Prepares a synchronized table for schema changes. This function must be called before altering the table. Failure to use `cloudsync_begin_alter` and `cloudsync_commit_alter` can lead to synchronization errors and data divergence. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md index 926ae77..5adead0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_cleanup +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-cleanup +--- + ### `cloudsync_cleanup(table_name)` **Description:** Removes the `sqlite-sync` synchronization mechanism from a specified table or all tables. This operation drops the associated `_cloudsync` metadata table and removes triggers from the target table(s). Use this function when synchronization is no longer desired for a table. @@ -14,4 +22,4 @@ -- Clean up a single table SELECT cloudsync_cleanup('my_table'); -``` \ No newline at end of file +``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md index 1a7ad1c..f8efcdd 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_commit_alter +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-commit-alter +--- + ### `cloudsync_commit_alter(table_name)` **Description:** Finalizes schema changes for a synchronized table. This function must be called after altering the table's schema, completing the process initiated by `cloudsync_begin_alter` and ensuring CRDT data consistency. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md index 9bcf704..b6db76b 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_db_version +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-db-version +--- + ### `cloudsync_db_version()` **Description:** Returns the current database version. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md index 3c86674..0fc5c2a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_disable +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-disable +--- + ### `cloudsync_disable(table_name)` **Description:** Disables synchronization for the specified table. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md index 68c5cdf..dc98e6a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_enable +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-enable +--- + ### `cloudsync_enable(table_name)` **Description:** Enables synchronization for the specified table. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md index c5d85df..c48e737 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_init +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-init +--- + ### `cloudsync_init(table_name, [crdt_algo], [force])` **Description:** Initializes a table for `sqlite-sync` synchronization. This function is idempotent and needs to be called only once per table on each site; configurations are stored in the database and automatically loaded with the extension. @@ -18,7 +26,7 @@ When designing your database schema for SQLite Sync, follow these essential requ - **Foreign Key Compatibility**: Be aware of potential conflicts during CRDT merge operations and RLS policy interactions. - **Trigger Compatibility**: Triggers may cause duplicate operations or be called multiple times due to column-by-column processing. -For comprehensive guidelines, see the [Database Schema Recommendations](https://github.com/sqliteai/sqlite-sync/blob/main/README.md#database-schema-recommendations) section. +For comprehensive guidelines, see the [Database Schema Recommendations](/docs/sqlite-sync-best-practices) section. The function supports three overloads: diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md index 1b725f7..806c322 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_is_enabled +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-is-enabled +--- + ### `cloudsync_is_enabled(table_name)` **Description:** Checks if synchronization is enabled for the specified table. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md index 7803920..9a0298c 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_check_changes +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-check-changes +--- + ### `cloudsync_network_check_changes()` **Description:** Checks the remote server for new changes and applies them to the local database. @@ -5,7 +13,7 @@ If a package of new changes is already available for the local site, the server returns it immediately, and the changes are applied. If no package is ready, the server returns an empty response and starts an asynchronous process to prepare a new package. This new package can be retrieved with a subsequent call to this function. This function is designed to be called periodically to keep the local database in sync. -To force an update and wait for changes (with a timeout), use [`cloudsync_network_sync(wait_ms, max_retries)`]. +To force an update and wait for changes (with a timeout), use `cloudsync_network_sync(wait_ms, max_retries)`. If the network is misconfigured or the remote server is unreachable, the function returns an error. On success, it returns `SQLITE_OK`, and the return value indicates how many changes were downloaded and applied. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md index 4476bb6..062d6de 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_cleanup +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-cleanup +--- + ### `cloudsync_network_cleanup()` **Description:** Cleans up the `sqlite-sync` network component, releasing all resources allocated by `cloudsync_network_init` (memory, cURL handles). diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md index 9b5f2b7..1f137c9 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_has_unsent_changes +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-has-unsent-changes +--- + ### `cloudsync_network_has_unsent_changes()` **Description:** Checks if there are any local changes that have not yet been sent to the remote server. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md index 83c8137..a2eba92 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_init +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-init +--- + ### `cloudsync_network_init(connection_string)` **Description:** Initializes the `sqlite-sync` network component. This function parses the connection string to configure change checking and upload endpoints, and initializes the cURL library. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md index 8a3c281..bfa276c 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_logout +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-logout +--- + ### `cloudsync_network_logout()` **Description:** Logs out the current user and cleans up all local data from synchronized tables. This function deletes and then re-initializes synchronized tables, useful for switching users or resetting the local database. **Warning:** This function deletes all data from synchronized tables. Use with caution. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md index e0d6fe6..893ea01 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_reset_sync_version +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-reset-sync-version +--- + ### `cloudsync_network_reset_sync_version()` **Description:** Resets local synchronization version numbers, forcing the next sync to fetch all changes from the server. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md index 4b35f07..4d6d17a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_send_changes +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-send-changes +--- + ### `cloudsync_network_send_changes()` **Description:** Sends all unsent local changes to the remote server. @@ -6,8 +14,6 @@ **Returns:** None. -**Errors:** See [Network Errors](#network-errors) for common error conditions. - **Example:** ```sql diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md index 7b72a8b..4ed035b 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_set_apikey +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-set-apikey +--- + ### `cloudsync_network_set_apikey(apikey)` **Description:** Sets the API key for network requests. This key is included in the `Authorization` header of all subsequent requests. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md index 667551f..703f0e0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md @@ -1,6 +1,14 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_set_token +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-set-token +--- + ### `cloudsync_network_set_token(token)` -**Description:** Sets the authentication token to be used for network requests. This token will be included in the `Authorization` header of all subsequent requests. For more information, refer to the [Access Tokens documentation](https://docs.sqlitecloud.io/docs/access-tokens). +**Description:** Sets the authentication token to be used for network requests. This token will be included in the `Authorization` header of all subsequent requests. For more information, refer to the [Access Tokens documentation](/docs/access-tokens). **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md index 649c7bd..d3fab9c 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_network_sync +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-network-sync +--- + ### `cloudsync_network_sync([wait_ms], [max_retries])` **Description:** Performs a full synchronization cycle. This function has two overloads: @@ -12,8 +20,6 @@ **Returns:** The number of changes downloaded. Errors are reported via the SQLite return code. -**Errors:** See [Network Errors](#network-errors) for common error conditions. - **Example:** ```sql diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md index 7a3b2c6..338928c 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_siteid +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-siteid +--- + ### `cloudsync_siteid()` **Description:** Returns the unique ID of the local site. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md index b9aa8c3..8c3e23d 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_terminate +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-terminate +--- + ### `cloudsync_terminate()` **Description:** Releases all internal resources used by the `sqlite-sync` extension for the current database connection. This function should be called before closing the database connection to ensure that all prepared statements and allocated memory are freed. Failing to call this function can result in memory leaks or a failed `sqlite3_close` operation due to pending statements. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md index a152ae8..1e9261a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_uuid +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-uuid +--- + ### `cloudsync_uuid()` **Description:** Generates a new universally unique identifier (UUIDv7). This is useful for creating globally unique primary keys for new records, which is a best practice for CRDTs. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md index 5381550..1d7dce2 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync API Reference - cloudsync_version +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-api-cloudsync-version +--- + ### `cloudsync_version()` **Description:** Returns the version of the `sqlite-sync` library. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md b/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md index 1dbd2bc..5e77af8 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/best-practices.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync Best Practices +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-best-practices +--- + ## Database Schema Recommendations When designing your database schema for SQLite Sync, follow these best practices to ensure optimal CRDT performance and conflict resolution: @@ -64,7 +72,7 @@ CREATE TABLE users ( ### Foreign Key Compatibility -When using foreign key constraints with SQLite Sync, be aware that interactions with the CRDT merge algorithm and Row-Level Security policies may cause constraint violations. +When using foreign key constraints with SQLite Sync, be aware that interactions with the CRDT merge algorithm and Row-Level Security policies may cause constraint violations. #### Potential Conflicts @@ -75,18 +83,21 @@ When using foreign key constraints with SQLite Sync, be aware that interactions - If a foreign key column has a DEFAULT value, that value must exist in the referenced table **Row-Level Security and CASCADE Actions** + - RLS policies may block operations required for maintaining referential integrity - CASCADE DELETE/UPDATE operations may fail if RLS prevents access to related rows #### Recommendations **Database Design Patterns** + - Prefer application-level cascade logic over database-level CASCADE actions - Design RLS policies to accommodate referential integrity operations - Use nullable foreign keys where appropriate to avoid DEFAULT value issues - Alternatively, ensure DEFAULT values for foreign key columns exist in their referenced tables **Testing and Validation** + - Test synchronization scenarios with foreign key constraints enabled - Monitor for constraint violations during sync operations in development @@ -95,10 +106,12 @@ When using foreign key constraints with SQLite Sync, be aware that interactions Be aware that certain types of triggers can cause errors during synchronization due to SQLite Sync's merge logic. **Duplicate Operations** + - If a trigger modifies a table that is also synchronized with SQLite Sync, changes performed by the trigger may be applied twice during the merge operation - This can lead to constraint violations or unexpected data states depending on the table's constraints **Column-by-Column Processing** + - SQLite Sync applies changes column-by-column during synchronization - UPDATE triggers may be called multiple times for a single row as each column is processed -- This can result in unexpected trigger behavior \ No newline at end of file +- This can result in unexpected trigger behavior diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md index 253ae61..a2e325e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync Getting Started +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-getting-started +--- + # Getting Started Here's a quick example to get started with SQLite Sync: @@ -12,7 +20,7 @@ Here's a quick example to get started with SQLite Sync: 1. Create a new project and database in your [SQLite Cloud Dashboard](https://dashboard.sqlitecloud.io/) 2. Copy your connection string and API key from the dashboard 3. Create tables with identical schema in both local and cloud databases -4. [Enable synchronization](https://docs.sqlitecloud.io/docs/offsync#:~:text=in%20the%20cloud.-,Configuring%20OffSync,-You%20can%20enable): go to Databases > Offsync page and select each table you want to synchronize in your database +4. [Enable synchronization](/docs/offsync#:~:text=in%20the%20cloud.-,Configuring%20OffSync,-You%20can%20enable): go to Databases > Offsync page and select each table you want to synchronize in your database ### Local Database Setup diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md index 8dcc8c1..2aa05b7 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md @@ -1,9 +1,9 @@ --- -title: SQLite-Sync -description: SQLite Cloud is a distributed relational database system built on top of the SQLite database engine. +title: SQLite-Sync Introduction +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish -slug: sqlite-sync +slug: sqlite-sync-introduction --- # Introduction to SQLite Sync @@ -93,6 +93,7 @@ SQLite Sync is ideal for building collaborative and distributed apps across web, ## Integrations Use SQLite-Sync alongside: + - **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** – on-device inference, embedding generation, and model interaction directly into your database - **[SQLite-Vector](https://github.com/sqliteai/sqlite-vector)** – vector search from SQL - **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** – define SQLite functions in JavaScript diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md index 3b6f179..a01c99f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync Android Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-android +--- + # Android Quick Start Guide This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. @@ -18,8 +26,8 @@ dependencies { 1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) 2. Download your preferred .zip architecture releases: - - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) - - x86_64 - 64-bit x86 emulators and Intel-based devices + - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) + - x86_64 - 64-bit x86 emulators and Intel-based devices 3. Extract and place the `cloudsync.so` file in: `app/src/main/assets/lib/cloudsync.so` ### 3. Basic Integration diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md index cad4a1c..6c58825 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync IOS Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-ios +--- + # IOS Quick Start Guide This guide will walk you through setting up SQLite in Swift to load CloudsSync extensions. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md index b302d07..bb3c3c0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync Linux Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-linux +--- + ## Linux Quick Start SQLite on Linux supports dynamic extension loading via `.so` shared libraries. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md index fc9ea90..108237e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync MacOS Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-macos +--- + # MacOS Quick Start Guide This guide explains how to install SQLite on macOS with support for loading extensions. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md index 3778e4f..79cc2dc 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync Expo Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-expo +--- + # React Native - Expo Quick Start Guide This guide shows how to integrate CloudSync extensions in Expo and React Native applications using OP-SQLite. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md index 3a0e13e..085daaa 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync WASM Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-wasm +--- + # WASM Quick Start Guide 1. Install the WebAssembly (WASM) version of SQLite with the SQLite Sync extension enabled from npm: diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md index f9625f1..0d17cf2 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -1,3 +1,11 @@ +--- +title: SQLite-Sync WASM Quick Start +description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. +category: platform +status: publish +slug: sqlite-sync-quick-start-windows +--- + ## Windows Quick Start This guide explains how to install SQLite on Windows with support for loading extensions. @@ -69,6 +77,7 @@ This guide shows how to load a native SQLite extension (e.g., **`cloudsync.dll`* ### 1. Install the SQLite package Install the [`Microsoft.Data.Sqlite`](https://www.nuget.org/packages/Microsoft.Data.Sqlite) NuGet package: + ```bash dotnet add package Microsoft.Data.Sqlite ``` @@ -78,6 +87,7 @@ dotnet add package Microsoft.Data.Sqlite Place `cloudsync.dll` in your project and configure it to copy to the output folder. Example directory structure: + ``` MyApp/ Program.cs @@ -87,6 +97,7 @@ MyApp/ ``` Configure your `MyApp.csproj` file: + ```xml @@ -112,6 +123,7 @@ Configure your `MyApp.csproj` file: ### 3. Load the extension in your code Create your `Program.cs` file to initialize SQLite and load the extension: + ```csharp using System; using Microsoft.Data.Sqlite; @@ -152,12 +164,14 @@ class Program ### 4. Run your application Build and run your application: + ```bash dotnet build dotnet run ``` You should see output similar to: + ``` SQLite version: 3.45.0 cloudsync_version(): 1.0.0 @@ -208,6 +222,7 @@ SQLite searches for extensions in this order: ### Deployment When publishing your app, ensure the extension is included: + ```bash dotnet publish -c Release -r win-x64 --self-contained false ``` From 6e48ce9b934c7b5a0f4e8c857818f6ee98903dab Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Tue, 30 Sep 2025 17:10:21 +0200 Subject: [PATCH 159/185] fix: typo --- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md index 6c58825..294528b 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md @@ -1,12 +1,12 @@ --- -title: SQLite-Sync IOS Quick Start +title: SQLite-Sync iOS Quick Start description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-ios --- -# IOS Quick Start Guide +# iOS Quick Start Guide This guide will walk you through setting up SQLite in Swift to load CloudsSync extensions. From fbe6bb20e209ee69fa1132108308cc9da375ed57 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Tue, 30 Sep 2025 17:20:25 +0200 Subject: [PATCH 160/185] fix: sidebarNav - add new pages --- sqlite-cloud/_nav.ts | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index f6a267d..265e53c 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -7,7 +7,41 @@ const sidebarNav: SidebarNavStruct = [ { title: "Overview", filePath: "ai-overview", type: "inner", level: 0 }, { title: "SQLite-AI", filePath: "sqlite-ai", type: "inner", level: 0 }, { title: "SQLite-JS", filePath: "sqlite-js", type: "inner", level: 0 }, - { title: "SQLite-Sync", filePath: "sqlite-sync", type: "inner", level: 0 }, + { title: "SQLite-Sync", type: "inner", level: 0 }, + { title: "Introduction", filePath: "sqlite-sync-introduction", type: "inner", level: 1 }, + { title: "Getting Started", filePath: "sqlite-sync-getting-started", type: "inner", level: 1 }, + { title: "Best Practices", filePath: "sqlite-sync-best-practices", type: "inner", level: 1 }, + { title: "Quick Starts", type: "inner", level: 1 }, + { title: "iOS", filePath: "sqlite-sync-quick-start-ios", type: "inner", level: 2 }, + { title: "Android", filePath: "sqlite-sync-quick-start-android", type: "inner", level: 2 }, + { title: "Linux", filePath: "sqlite-sync-quick-start-linux", type: "inner", level: 2 }, + { title: "macOS", filePath: "sqlite-sync-quick-start-macos", type: "inner", level: 2 }, + { title: "React Native Expo", filePath: "sqlite-sync-quick-start-react-native-expo", type: "inner", level: 2 }, + { title: "WASM", filePath: "sqlite-sync-quick-start-wasm", type: "inner", level: 2 }, + { title: "Windows", filePath: "sqlite-sync-quick-start-windows", type: "inner", level: 2 }, + { title: "API Reference", type: "inner", level: 1 }, + { title: "cloudsync_init", filePath: "sqlite-sync-api-cloudsync-init", type: "inner", level: 2 }, + { title: "cloudsync_enable", filePath: "sqlite-sync-api-cloudsync-enable", type: "inner", level: 2 }, + { title: "cloudsync_disable", filePath: "sqlite-sync-api-cloudsync-disable", type: "inner", level: 2 }, + { title: "cloudsync_is_enabled", filePath: "sqlite-sync-api-cloudsync-is-enabled", type: "inner", level: 2 }, + { title: "cloudsync_cleanup", filePath: "sqlite-sync-api-cloudsync-cleanup", type: "inner", level: 2 }, + { title: "cloudsync_terminate", filePath: "sqlite-sync-api-cloudsync-terminate", type: "inner", level: 2 }, + { title: "cloudsync_version", filePath: "sqlite-sync-api-cloudsync-version", type: "inner", level: 2 }, + { title: "cloudsync_siteid", filePath: "sqlite-sync-api-cloudsync-siteid", type: "inner", level: 2 }, + { title: "cloudsync_db_version", filePath: "sqlite-sync-api-cloudsync-db-version", type: "inner", level: 2 }, + { title: "cloudsync_uuid", filePath: "sqlite-sync-api-cloudsync-uuid", type: "inner", level: 2 }, + { title: "cloudsync_begin_alter", filePath: "sqlite-sync-api-cloudsync-begin-alter", type: "inner", level: 2 }, + { title: "cloudsync_commit_alter", filePath: "sqlite-sync-api-cloudsync-commit-alter", type: "inner", level: 2 }, + { title: "cloudsync_network_init", filePath: "sqlite-sync-api-cloudsync-network-init", type: "inner", level: 2 }, + { title: "cloudsync_network_cleanup", filePath: "sqlite-sync-api-cloudsync-network-cleanup", type: "inner", level: 2 }, + { title: "cloudsync_network_set_token", filePath: "sqlite-sync-api-cloudsync-network-set-token", type: "inner", level: 2 }, + { title: "cloudsync_network_set_apikey", filePath: "sqlite-sync-api-cloudsync-network-set-apikey", type: "inner", level: 2 }, + { title: "cloudsync_network_has_unsent_changes", filePath: "sqlite-sync-api-cloudsync-network-has-unsent-changes", type: "inner", level: 2 }, + { title: "cloudsync_network_send_changes", filePath: "sqlite-sync-api-cloudsync-network-send-changes", type: "inner", level: 2 }, + { title: "cloudsync_network_check_changes", filePath: "sqlite-sync-api-cloudsync-network-check-changes", type: "inner", level: 2 }, + { title: "cloudsync_network_sync", filePath: "sqlite-sync-api-cloudsync-network-sync", type: "inner", level: 2 }, + { title: "cloudsync_network_reset_sync_version", filePath: "sqlite-sync-api-cloudsync-network-reset-sync-version", type: "inner", level: 2 }, + { title: "cloudsync_network_logout", filePath: "sqlite-sync-api-cloudsync-network-logout", type: "inner", level: 2 }, { title: "SQLite-Vector", filePath: "sqlite-vector", type: "inner", level: 0 }, { title: "MCP (Model Context Protocol)", filePath: "mcp-server", type: "inner", level: 0 }, From b1632190e167cf17d380ac267fccf6bdd7d94c32 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 3 Oct 2025 13:54:48 +0200 Subject: [PATCH 161/185] fix: titles --- sqlite-cloud/_nav.ts | 6 +++--- .../sqlite-sync/api-reference/cloudsync_begin_alter.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_cleanup.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_commit_alter.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_db_version.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_disable.md | 4 +--- .../sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md | 4 +--- .../sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_is_enabled.md | 4 +--- .../api-reference/cloudsync_network_check_changes.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_network_cleanup.md | 4 +--- .../api-reference/cloudsync_network_has_unsent_changes.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_network_init.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_network_logout.md | 4 +--- .../api-reference/cloudsync_network_reset_sync_version.md | 4 +--- .../api-reference/cloudsync_network_send_changes.md | 4 +--- .../api-reference/cloudsync_network_set_apikey.md | 4 +--- .../api-reference/cloudsync_network_set_token.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_network_sync.md | 4 +--- .../sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_terminate.md | 4 +--- .../sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md | 4 +--- .../sqlite-sync/api-reference/cloudsync_version.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md | 4 +--- .../sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md | 4 +--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md | 4 +--- 32 files changed, 34 insertions(+), 96 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 265e53c..2480a32 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -12,11 +12,11 @@ const sidebarNav: SidebarNavStruct = [ { title: "Getting Started", filePath: "sqlite-sync-getting-started", type: "inner", level: 1 }, { title: "Best Practices", filePath: "sqlite-sync-best-practices", type: "inner", level: 1 }, { title: "Quick Starts", type: "inner", level: 1 }, + { title: "Android", filePath: "sqlite-sync-quick-start-android", type: "inner", level: 2 }, { title: "iOS", filePath: "sqlite-sync-quick-start-ios", type: "inner", level: 2 }, - { title: "Android", filePath: "sqlite-sync-quick-start-android", type: "inner", level: 2 }, { title: "Linux", filePath: "sqlite-sync-quick-start-linux", type: "inner", level: 2 }, - { title: "macOS", filePath: "sqlite-sync-quick-start-macos", type: "inner", level: 2 }, - { title: "React Native Expo", filePath: "sqlite-sync-quick-start-react-native-expo", type: "inner", level: 2 }, + { title: "macOS", filePath: "sqlite-sync-quick-start-macos", type: "inner", level: 2 }, + { title: "React Native Expo", filePath: "sqlite-sync-quick-start-expo", type: "inner", level: 2 }, { title: "WASM", filePath: "sqlite-sync-quick-start-wasm", type: "inner", level: 2 }, { title: "Windows", filePath: "sqlite-sync-quick-start-windows", type: "inner", level: 2 }, { title: "API Reference", type: "inner", level: 1 }, diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md index 1821c9c..e5ce51e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_begin_alter.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_begin_alter +title: "cloudsync_begin_alter(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-begin-alter --- -### `cloudsync_begin_alter(table_name)` - **Description:** Prepares a synchronized table for schema changes. This function must be called before altering the table. Failure to use `cloudsync_begin_alter` and `cloudsync_commit_alter` can lead to synchronization errors and data divergence. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md index 5adead0..8d364d8 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_cleanup.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_cleanup +title: "cloudsync_cleanup(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-cleanup --- -### `cloudsync_cleanup(table_name)` - **Description:** Removes the `sqlite-sync` synchronization mechanism from a specified table or all tables. This operation drops the associated `_cloudsync` metadata table and removes triggers from the target table(s). Use this function when synchronization is no longer desired for a table. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md index f8efcdd..73e56d7 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_commit_alter.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_commit_alter +title: "cloudsync_commit_alter(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-commit-alter --- -### `cloudsync_commit_alter(table_name)` - **Description:** Finalizes schema changes for a synchronized table. This function must be called after altering the table's schema, completing the process initiated by `cloudsync_begin_alter` and ensuring CRDT data consistency. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md index b6db76b..cdef894 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_db_version.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_db_version +title: "cloudsync_db_version()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-db-version --- -### `cloudsync_db_version()` - **Description:** Returns the current database version. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md index 0fc5c2a..0c13f8b 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_disable.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_disable +title: "cloudsync_disable(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-disable --- -### `cloudsync_disable(table_name)` - **Description:** Disables synchronization for the specified table. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md index dc98e6a..d13c31e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_enable.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_enable +title: "cloudsync_enable(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-enable --- -### `cloudsync_enable(table_name)` - **Description:** Enables synchronization for the specified table. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md index c48e737..16b0d7f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_init.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_init +title: "cloudsync_init(table_name, [crdt_algo], [force])" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-init --- -### `cloudsync_init(table_name, [crdt_algo], [force])` - **Description:** Initializes a table for `sqlite-sync` synchronization. This function is idempotent and needs to be called only once per table on each site; configurations are stored in the database and automatically loaded with the extension. Before initialization, `cloudsync_init` performs schema sanity checks to ensure compatibility with CRDT requirements and best practices. These checks include: diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md index 806c322..3f72554 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_is_enabled.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_is_enabled +title: "cloudsync_is_enabled(table_name)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-is-enabled --- -### `cloudsync_is_enabled(table_name)` - **Description:** Checks if synchronization is enabled for the specified table. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md index 9a0298c..5e3b809 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_check_changes.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_check_changes +title: "cloudsync_network_check_changes()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-check-changes --- -### `cloudsync_network_check_changes()` - **Description:** Checks the remote server for new changes and applies them to the local database. If a package of new changes is already available for the local site, the server returns it immediately, and the changes are applied. If no package is ready, the server returns an empty response and starts an asynchronous process to prepare a new package. This new package can be retrieved with a subsequent call to this function. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md index 062d6de..bf1dbc0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_cleanup.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_cleanup +title: "cloudsync_network_cleanup()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-cleanup --- -### `cloudsync_network_cleanup()` - **Description:** Cleans up the `sqlite-sync` network component, releasing all resources allocated by `cloudsync_network_init` (memory, cURL handles). **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md index 1f137c9..fcbad04 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_has_unsent_changes.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_has_unsent_changes +title: "cloudsync_network_has_unsent_changes()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-has-unsent-changes --- -### `cloudsync_network_has_unsent_changes()` - **Description:** Checks if there are any local changes that have not yet been sent to the remote server. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md index a2eba92..52bda2d 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_init.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_init +title: "cloudsync_network_init(connection_string)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-init --- -### `cloudsync_network_init(connection_string)` - **Description:** Initializes the `sqlite-sync` network component. This function parses the connection string to configure change checking and upload endpoints, and initializes the cURL library. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md index bfa276c..ba565d9 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_logout.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_logout +title: "cloudsync_network_logout()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-logout --- -### `cloudsync_network_logout()` - **Description:** Logs out the current user and cleans up all local data from synchronized tables. This function deletes and then re-initializes synchronized tables, useful for switching users or resetting the local database. **Warning:** This function deletes all data from synchronized tables. Use with caution. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md index 893ea01..ff92454 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_reset_sync_version.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_reset_sync_version +title: "cloudsync_network_reset_sync_version()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-reset-sync-version --- -### `cloudsync_network_reset_sync_version()` - **Description:** Resets local synchronization version numbers, forcing the next sync to fetch all changes from the server. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md index 4d6d17a..45e8d1b 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_send_changes.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_send_changes +title: "cloudsync_network_send_changes()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-send-changes --- -### `cloudsync_network_send_changes()` - **Description:** Sends all unsent local changes to the remote server. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md index 4ed035b..ed47ee2 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_apikey.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_set_apikey +title: "cloudsync_network_set_apikey(apikey)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-set-apikey --- -### `cloudsync_network_set_apikey(apikey)` - **Description:** Sets the API key for network requests. This key is included in the `Authorization` header of all subsequent requests. **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md index 703f0e0..fdc0bb0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_set_token.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_set_token +title: "cloudsync_network_set_token(token)" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-set-token --- -### `cloudsync_network_set_token(token)` - **Description:** Sets the authentication token to be used for network requests. This token will be included in the `Authorization` header of all subsequent requests. For more information, refer to the [Access Tokens documentation](/docs/access-tokens). **Parameters:** diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md index d3fab9c..0761156 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_network_sync.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_network_sync +title: "cloudsync_network_sync([wait_ms], [max_retries])" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-network-sync --- -### `cloudsync_network_sync([wait_ms], [max_retries])` - **Description:** Performs a full synchronization cycle. This function has two overloads: - `cloudsync_network_sync()`: Performs one send operation and one check operation. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md index 338928c..49e6c30 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_siteid.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_siteid +title: "cloudsync_siteid()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-siteid --- -### `cloudsync_siteid()` - **Description:** Returns the unique ID of the local site. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md index 8c3e23d..a8e646e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_terminate.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_terminate +title: "cloudsync_terminate()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-terminate --- -### `cloudsync_terminate()` - **Description:** Releases all internal resources used by the `sqlite-sync` extension for the current database connection. This function should be called before closing the database connection to ensure that all prepared statements and allocated memory are freed. Failing to call this function can result in memory leaks or a failed `sqlite3_close` operation due to pending statements. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md index 1e9261a..fa976bb 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_uuid.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_uuid +title: "cloudsync_uuid()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-uuid --- -### `cloudsync_uuid()` - **Description:** Generates a new universally unique identifier (UUIDv7). This is useful for creating globally unique primary keys for new records, which is a best practice for CRDTs. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md index 1d7dce2..f1033e6 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/api-reference/cloudsync_version.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync API Reference - cloudsync_version +title: "cloudsync_version()" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-api-cloudsync-version --- -### `cloudsync_version()` - **Description:** Returns the version of the `sqlite-sync` library. **Parameters:** None. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md index a2e325e..9850493 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync Getting Started +title: "Getting Started" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-getting-started --- -# Getting Started - Here's a quick example to get started with SQLite Sync: ### Prerequisites diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md index 2aa05b7..cc4a012 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync Introduction +title: "Introduction to SQLite Sync" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-introduction --- -# Introduction to SQLite Sync - [SQLite Sync](https://github.com/sqliteai/sqlite-sync) is a multi-platform extension that brings a true **local-first experience** to your applications with minimal effort. It extends standard SQLite tables with built-in support for offline work and automatic synchronization, allowing multiple devices to operate independently—even without a network connection—and seamlessly stay in sync. With SQLite Sync, developers can easily build **distributed, collaborative applications** while continuing to rely on the **simplicity, reliability, and performance of SQLite**. Under the hood, SQLite Sync uses advanced **CRDT (Conflict-free Replicated Data Type)** algorithms and data structures designed specifically for **collaborative, distributed systems**. This means: diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md index a01c99f..d74d2e3 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync Android Quick Start +title: "Android Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-android --- -# Android Quick Start Guide - This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. This example uses the [requery:sqlite-android](https://github.com/requery/sqlite-android) library, but other options include building a custom SQLite with extension support or using other third-party SQLite libraries that enable extension loading. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md index 294528b..19f7f7f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync iOS Quick Start +title: "iOS Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-ios --- -# iOS Quick Start Guide - This guide will walk you through setting up SQLite in Swift to load CloudsSync extensions. ## 1. Create a New Swift Project diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md index bb3c3c0..f0299ec 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync Linux Quick Start +title: Linux Quick Start description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-linux --- -## Linux Quick Start - SQLite on Linux supports dynamic extension loading via `.so` shared libraries. This guide walks through how to load an extension named `cloudsync.so` on common Linux distributions via SQLite3 Command Line. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md index 108237e..48e3706 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync MacOS Quick Start +title: "MacOS Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-macos --- -# MacOS Quick Start Guide - This guide explains how to install SQLite on macOS with support for loading extensions. ## macOS and xcframework diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md index 79cc2dc..c13237f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync Expo Quick Start +title: "React Native - Expo Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-expo --- -# React Native - Expo Quick Start Guide - This guide shows how to integrate CloudSync extensions in Expo and React Native applications using OP-SQLite. ## Getting Started diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md index 085daaa..fbbefda 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync WASM Quick Start +title: "WASM Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-wasm --- -# WASM Quick Start Guide - 1. Install the WebAssembly (WASM) version of SQLite with the SQLite Sync extension enabled from npm: ``` diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md index 0d17cf2..ec78376 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -1,13 +1,11 @@ --- -title: SQLite-Sync WASM Quick Start +title: Windows Quick Start description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-windows --- -## Windows Quick Start - This guide explains how to install SQLite on Windows with support for loading extensions. ## Using SQLite with Python From ddab8acb9f408b029449178744394a78d8d2ac4d Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 3 Oct 2025 14:36:06 +0200 Subject: [PATCH 162/185] chore: update android file --- .../sqlite-sync/quick-starts/android.md | 106 +++++++++++------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md index d74d2e3..81d80f0 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -1,9 +1,10 @@ ---- +r--- title: "Android Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-android + --- This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. @@ -14,71 +15,92 @@ This example uses the [requery:sqlite-android](https://github.com/requery/sqlite In your `app/build.gradle.kts`: +
    +Groovy DSL + +```groovy +repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } +} +dependencies { + // ... + // Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions + implementation 'com.github.requery:sqlite-android:3.49.0' + // Both packages below are identical - use either one + implementation 'ai.sqlite:sync:0.8.39' // Maven Central + // implementation 'com.github.sqliteai:sqlite-sync:0.8.39' // JitPack (alternative) +} +``` +
    + +
    +Kotlin DSL + ```kotlin +repositories { + google() + mavenCentral() + maven(url = "https://jitpack.io") +} dependencies { + // ... + // Use requery's SQLite instead of Android's built-in SQLite to support loading custom extensions implementation("com.github.requery:sqlite-android:3.49.0") + // Both packages below are identical - use either one + implementation("ai.sqlite:sync:0.8.39") // Maven Central + // implementation("com.github.sqliteai:sqlite-sync:0.8.39") // JitPack (alternative) } ``` +
    + +### 2. Update AndroidManifest.xml -### 2. Bundle the Extension +Add `android:extractNativeLibs="true"` to your `` tag: -1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) -2. Download your preferred .zip architecture releases: - - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) - - x86_64 - 64-bit x86 emulators and Intel-based devices -3. Extract and place the `cloudsync.so` file in: `app/src/main/assets/lib/cloudsync.so` +```xml + +``` ### 3. Basic Integration Here’s a complete example showing how to load the extension, create a table, initialize CloudSync, and perform network sync. +> **Important:** Replace the following placeholders with your actual values: +> +> - `database_name` - Your database name +> - `table_name` - Your table name +> - `` - Your SQLiteCloud connection string +> - `` - Your SQLiteCloud API key + ```kotlin -import android.content.Context import android.os.Bundle import androidx.activity.ComponentActivity import androidx.lifecycle.lifecycleScope import io.requery.android.database.sqlite.SQLiteCustomExtension -import io.requery.android.database.sqlite.SQLiteCustomFunction import io.requery.android.database.sqlite.SQLiteDatabase import io.requery.android.database.sqlite.SQLiteDatabaseConfiguration -import io.requery.android.database.sqlite.SQLiteFunction import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import java.io.File -import java.io.FileOutputStream class MainActivity : ComponentActivity() { - private fun copyExtensionToFilesDir(context: Context): File { - val assetManager = context.assets - val inputStream = assetManager.open("lib/cloudsync.so") - - val outFile = File(context.filesDir, "cloudsync.so") - inputStream.use { input -> - FileOutputStream(outFile).use { output -> - input.copyTo(output) - } - } - return outFile - } - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - // --- Copy extension from assets to filesystem --- - val extensionFile = copyExtensionToFilesDir(this) - val extensionPath = extensionFile.absolutePath - // --- Create extension configuration --- - val cloudSyncExtension = SQLiteCustomExtension(extensionPath, null) + val cloudsyncExtension = SQLiteCustomExtension(applicationInfo.nativeLibraryDir + "/cloudsync", null) // --- Configure database with extension --- val config = SQLiteDatabaseConfiguration( - "${filesDir.path}/database_name.db", + cacheDir.path + "/database_name.db", SQLiteDatabase.CREATE_IF_NECESSARY or SQLiteDatabase.OPEN_READWRITE, - emptyList(), - emptyList(), - listOf(cloudSyncExtension) + emptyList(), + emptyList(), + listOf(cloudsyncExtension) ) // --- Open database --- @@ -103,9 +125,9 @@ class MainActivity : ComponentActivity() { // --- Create test table --- val createTableSQL = """ CREATE TABLE IF NOT EXISTS $tableName ( - id TEXT PRIMARY KEY NOT NULL, - value TEXT NOT NULL DEFAULT '', - created_at TEXT DEFAULT CURRENT_TIMESTAMP + id TEXT PRIMARY KEY NOT NULL, + value TEXT NOT NULL DEFAULT '', + created_at TEXT DEFAULT CURRENT_TIMESTAMP ); """.trimIndent() db.execSQL(createTableSQL) @@ -121,10 +143,16 @@ class MainActivity : ComponentActivity() { """.trimIndent()) // --- Initialize network connection --- - db.rawQuery("SELECT cloudsync_network_init('');", null).use { it.moveToFirst() } + db.rawQuery( + "SELECT cloudsync_network_init('');", + null + ).use { it.moveToFirst() } // --- Set API key --- - db.rawQuery( "SELECT cloudsync_network_set_apikey('');", null).use { it.moveToFirst() } + db.rawQuery( + "SELECT cloudsync_network_set_apikey('');", + null + ).use { it.moveToFirst() } // --- Run network sync multiple times --- // Note: cloudsync_network_sync() returns > 0 if data was sent/received. From 5a2ff5f9557b07d64df8652f2c814047fa53c403 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 3 Oct 2025 14:48:14 +0200 Subject: [PATCH 163/185] chore: update android doc --- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md index 81d80f0..a4be7b9 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -1,10 +1,9 @@ -r--- +--- title: "Android Quick Start Guide" description: SQLite Sync is a multi-platform extension that brings a true local-first experience to your applications with minimal effort. category: platform status: publish slug: sqlite-sync-quick-start-android - --- This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. @@ -13,8 +12,6 @@ This example uses the [requery:sqlite-android](https://github.com/requery/sqlite ### 1. Add Dependencies -In your `app/build.gradle.kts`: -
    Groovy DSL From 71e73fa794b18eceb327766cd88e88db88e86b5b Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 3 Oct 2025 14:50:58 +0200 Subject: [PATCH 164/185] chore: update android --- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md index a4be7b9..d403a34 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md @@ -6,12 +6,12 @@ status: publish slug: sqlite-sync-quick-start-android --- -This guide shows how to integrate sqlite sync extension into your Android application. Since extension loading is disabled by default in Android's SQLite implementation, you need an alternative SQLite library that supports extensions. - -This example uses the [requery:sqlite-android](https://github.com/requery/sqlite-android) library, but other options include building a custom SQLite with extension support or using other third-party SQLite libraries that enable extension loading. +This guide shows how to integrate sqlite-sync extension into your Android application. ### 1. Add Dependencies +You can [add sqlite-sync as a dependency to your Android project](https://central.sonatype.com/artifact/ai.sqlite/sync). +
    Groovy DSL From 335ba516f3350c43bcf65c7e62d4d131e867da65 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 10:11:50 +0200 Subject: [PATCH 165/185] chore: sqlite-sync android - add callout --- .../quick-starts/{android.md => android.mdx} | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) rename sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/{android.md => android.mdx} (90%) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx similarity index 90% rename from sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md rename to sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx index d403a34..79396fc 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx @@ -6,7 +6,9 @@ status: publish slug: sqlite-sync-quick-start-android --- -This guide shows how to integrate sqlite-sync extension into your Android application. +import Callout from "@commons-components/Information/Callout.astro"; + +This guide shows how to integrate sqlite-sync extension into your Android application. ### 1. Add Dependencies @@ -30,6 +32,7 @@ dependencies { // implementation 'com.github.sqliteai:sqlite-sync:0.8.39' // JitPack (alternative) } ``` +
    @@ -50,6 +53,7 @@ dependencies { // implementation("com.github.sqliteai:sqlite-sync:0.8.39") // JitPack (alternative) } ``` +
    ### 2. Update AndroidManifest.xml @@ -66,12 +70,19 @@ Add `android:extractNativeLibs="true"` to your `` tag: Here’s a complete example showing how to load the extension, create a table, initialize CloudSync, and perform network sync. -> **Important:** Replace the following placeholders with your actual values: -> -> - `database_name` - Your database name -> - `table_name` - Your table name -> - `` - Your SQLiteCloud connection string -> - `` - Your SQLiteCloud API key + + Replace the following placeholders with your actual values: + - `database_name` - Your database name + - `table_name` - Your table name + - `` - Your SQLiteCloud connection string + - `` - Your SQLiteCloud API key + + + + CloudSync functions must be executed with `SELECT`. In Android, use + `rawQuery()` to call them, and always call `moveToFirst()` (or `moveToNext()`) + on the cursor to ensure the query actually executes. + ```kotlin import android.os.Bundle @@ -179,9 +190,3 @@ class MainActivity : ComponentActivity() { } } ``` - -### 4. Notes on SQLite Usage in Android - -CloudSync functions must be executed with `SELECT`. In Android, use `rawQuery()` to call them, and always call `moveToFirst()` (or `moveToNext()`) on the cursor to ensure the query actually executes. - -For detailed SQLite Sync API documentation, see the main [documentation](https://github.com/sqliteai/sqlite-sync/blob/main/README.md). From 2d95067c4a78e60bd357d615524f7a9203e45444 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 10:14:17 +0200 Subject: [PATCH 166/185] chore: sqlite-sync android callout position --- .../sqlite-ai/sqlite-sync/quick-starts/android.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx index 79396fc..771f010 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx @@ -78,12 +78,6 @@ Here’s a complete example showing how to load the extension, create a table, i - `` - Your SQLiteCloud API key - - CloudSync functions must be executed with `SELECT`. In Android, use - `rawQuery()` to call them, and always call `moveToFirst()` (or `moveToNext()`) - on the cursor to ensure the query actually executes. - - ```kotlin import android.os.Bundle import androidx.activity.ComponentActivity @@ -190,3 +184,9 @@ class MainActivity : ComponentActivity() { } } ``` + + + CloudSync functions must be executed with `SELECT`. In Android, use + `rawQuery()` to call them, and always call `moveToFirst()` (or `moveToNext()`) + on the cursor to ensure the query actually executes. + \ No newline at end of file From b10e1fde281e0b6330dd018b6ccf658b940be592 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 10:19:03 +0200 Subject: [PATCH 167/185] fix: add code languages --- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md | 2 +- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md | 6 +++--- sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md index 48e3706..ec222ba 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md @@ -77,7 +77,7 @@ which python3 After installing Python with Homebrew, the `python` command now uses the Homebrew version. You can now load SQLite extensions in Python as shown here. -``` +```python import sqlite3 import os diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md index fbbefda..837888f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md @@ -8,13 +8,13 @@ slug: sqlite-sync-quick-start-wasm 1. Install the WebAssembly (WASM) version of SQLite with the SQLite Sync extension enabled from npm: - ``` + ```bash npm install @sqliteai/sqlite-wasm ``` 2. Create an HTML file that imports the SQLite WASM module using an import map and references the JavaScript loader: - ``` + ```html @@ -41,7 +41,7 @@ slug: sqlite-sync-quick-start-wasm 3. Create the JavaScript file (load_extension.js) that initializes the SQLite WASM worker and verifies the extension is loaded: - ``` + ```javascript /** * This example uses the package `@sqliteai/sqlite-wasm`. * This version of SQLite WASM is bundled with SQLite Sync and SQLite Vector extensions. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md index ec78376..969148a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -32,7 +32,7 @@ This guide explains how to install SQLite on Windows with support for loading ex 5. **Load Extension** - ``` + ```python import sqlite3 import os From 95f781f9cd0642da2ddb8b673ae3ef17c496d547 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 10:34:58 +0200 Subject: [PATCH 168/185] fix: sqlite vector link --- sqlite-cloud/sqlite-ai/sqlite-vector.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-vector.mdx b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx index 4a0fd31..73bf90a 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-vector.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx @@ -6,7 +6,7 @@ status: publish slug: sqlite-vector --- -[SQLite-Vector](https://website-stage.sqlitecloud.io/sqlite-vector) is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities directly into your embedded database +[SQLite-Vector](https://github.com/sqliteai/sqlite-vector) is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities directly into your embedded database Whether you're dealing with **millions of high-dimensional vectors** or operating on resource-constrained edge devices, SQLite-Vector delivers **lightning-fast performance** with a **tiny memory footprint**. From 2ad6dec6ebb89867b9416f89247c4d3609da4679 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 11:26:01 +0200 Subject: [PATCH 169/185] fix: add target="_blank" to external links --- sqlite-cloud/_nav.ts | 2 +- sqlite-cloud/architecture.mdx | 2 +- sqlite-cloud/multi-code-example.mdx | 4 +- sqlite-cloud/platform/_vector.mdx | 2 +- sqlite-cloud/platform/access-tokens.mdx | 6 +-- sqlite-cloud/platform/backups.mdx | 2 +- sqlite-cloud/platform/edge-functions.mdx | 12 ++--- sqlite-cloud/platform/extensions.mdx | 12 ++--- sqlite-cloud/platform/offsync.mdx | 2 +- sqlite-cloud/platform/rls.mdx | 6 +-- sqlite-cloud/platform/security.mdx | 8 +-- sqlite-cloud/platform/webhooks.mdx | 2 +- .../quickstart/quick-start-apollo-graphql.mdx | 4 +- sqlite-cloud/quickstart/quick-start-cdn.mdx | 2 +- .../quickstart/quick-start-django.mdx | 8 +-- sqlite-cloud/quickstart/quick-start-flask.mdx | 2 +- sqlite-cloud/quickstart/quick-start-gin.mdx | 4 +- sqlite-cloud/quickstart/quick-start-knex.mdx | 4 +- .../quickstart/quick-start-laravel.mdx | 8 +-- sqlite-cloud/quickstart/quick-start-next.mdx | 2 +- sqlite-cloud/quickstart/quick-start-node.mdx | 2 +- .../quickstart/quick-start-prisma.mdx | 2 +- .../quickstart/quick-start-react-native.mdx | 4 +- sqlite-cloud/quickstart/quick-start-react.mdx | 2 +- .../quickstart/quick-start-sqlalchemy-orm.mdx | 8 +-- .../quickstart/quick-start-streamlit.mdx | 2 +- sqlite-cloud/reference/api-key-commands.mdx | 10 ++-- sqlite-cloud/reference/auth-commands.mdx | 2 +- sqlite-cloud/reference/backup-commands.mdx | 12 ++--- sqlite-cloud/reference/cli-commands.mdx | 6 +-- sqlite-cloud/reference/cluster-commands.mdx | 8 +-- sqlite-cloud/reference/database-commands.mdx | 24 ++++----- sqlite-cloud/reference/general-commands.mdx | 26 +++++----- sqlite-cloud/reference/ip-commands.mdx | 8 +-- sqlite-cloud/reference/log-commands.mdx | 4 +- sqlite-cloud/reference/plugin-commands.mdx | 8 +-- sqlite-cloud/reference/privilege-commands.mdx | 8 +-- sqlite-cloud/reference/pub-sub-commands.mdx | 12 ++--- .../reference/query-analyzer-commands.mdx | 8 +-- sqlite-cloud/reference/role-commands.mdx | 12 ++--- sqlite-cloud/reference/settings-commands.mdx | 22 ++++---- sqlite-cloud/reference/user-commands.mdx | 18 +++---- sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobRead.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudError.mdx | 4 +- sqlite-cloud/sdks/c/SQCloudVMBind.mdx | 2 +- .../sdks/c/SQCloudVMBindParameterCount.mdx | 2 +- .../sdks/c/SQCloudVMBindParameterIndex.mdx | 2 +- .../sdks/c/SQCloudVMBindParameterName.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMClose.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMColumn.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMCompile.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx | 2 +- sqlite-cloud/sdks/c/SQCloudVMStep.mdx | 2 +- sqlite-cloud/sdks/c/getting-started.mdx | 6 +-- sqlite-cloud/sdks/go/introduction.mdx | 35 +++++++++---- sqlite-cloud/sdks/js/classes/Database.md | 50 +++++++++---------- .../sdks/js/classes/SQLiteCloudConnection.md | 22 ++++---- .../sdks/js/classes/SQLiteCloudError.md | 10 ++-- .../sdks/js/classes/SQLiteCloudRow.md | 10 ++-- .../sdks/js/classes/SQLiteCloudRowset.md | 24 ++++----- sqlite-cloud/sdks/js/classes/Statement.md | 26 +++++----- .../js/interfaces/SQLCloudRowsetMetadata.md | 8 +-- .../sdks/js/interfaces/SQLiteCloudConfig.md | 44 ++++++++-------- sqlite-cloud/sdks/js/introduction.mdx | 48 +++++++++--------- sqlite-cloud/sdks/js/modules.md | 10 ++-- sqlite-cloud/sdks/php/introduction.mdx | 2 +- sqlite-cloud/sdks/python/introduction.mdx | 2 +- sqlite-cloud/sdks/swift/introduction.mdx | 2 +- sqlite-cloud/sqlite-ai/mcp-server.mdx | 18 +++---- sqlite-cloud/sqlite-ai/sqlite-ai.mdx | 4 +- sqlite-cloud/sqlite-ai/sqlite-js.mdx | 6 +-- .../sqlite-ai/sqlite-sync/getting-started.md | 8 +-- .../sqlite-ai/sqlite-sync/introduction.md | 10 ++-- .../sqlite-sync/quick-starts/android.mdx | 2 +- .../sqlite-ai/sqlite-sync/quick-starts/ios.md | 7 ++- .../sqlite-sync/quick-starts/linux.md | 2 +- .../sqlite-sync/quick-starts/macos.md | 6 +-- .../quick-starts/react-native-expo.md | 6 +-- .../sqlite-sync/quick-starts/wasm.md | 2 +- .../sqlite-sync/quick-starts/windows.md | 10 ++-- sqlite-cloud/sqlite-ai/sqlite-vector.mdx | 4 +- sqlite-cloud/tutorials/tutorial-geopoly.mdx | 26 +++++----- sqlite/json1.md | 36 ++++++------- 91 files changed, 403 insertions(+), 385 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 2480a32..d66e587 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -615,7 +615,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "CLI", type: "inner", level: 0 }, { title: "Introduction", filePath: "cli-commands", type: "inner", level: 1 }, - { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite/" }, + { title: "SQLite", type: "inner", level: 0, href: "/docs/sqlite" }, ]; export default sidebarNav; diff --git a/sqlite-cloud/architecture.mdx b/sqlite-cloud/architecture.mdx index ecf444f..42eba8c 100644 --- a/sqlite-cloud/architecture.mdx +++ b/sqlite-cloud/architecture.mdx @@ -8,7 +8,7 @@ slug: architecture ## Architecture -SQLite Cloud uses the [Raft](https://raft.github.io) consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. +SQLite Cloud uses the Raft consensus algorithm to distribute your data changes across a cluster of computing systems, ensuring that each node in the cluster agrees upon the same series of state transitions. Raft implements consensus with a leader approach. SQLite Cloud is written in ANSI C and GO, and it works on most POSIX systems (Linux, *BSD, Mac OS X) and Windows. diff --git a/sqlite-cloud/multi-code-example.mdx b/sqlite-cloud/multi-code-example.mdx index e2403a0..bf43d97 100644 --- a/sqlite-cloud/multi-code-example.mdx +++ b/sqlite-cloud/multi-code-example.mdx @@ -10,8 +10,8 @@ import MultiCode from '@commons-components/Code/MultiCode.astro'; In this examples, we will show how to use the `MultiCode` component: -- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/MultiCode.astro) the definition of the `MultiCode` component. -- [Here](https://github.com/sqlitecloud/website/blob/docs-stage/commons/components/Code/Code.astro) the definition of the `Code` component that is used inside the `MultiCode` component. +- Here the definition of the `MultiCode` component. +- Here the definition of the `Code` component that is used inside the `MultiCode` component. In these two files there are the TypeScript definitions usefull to know all the avaible properties. diff --git a/sqlite-cloud/platform/_vector.mdx b/sqlite-cloud/platform/_vector.mdx index da9bff6..886c9ac 100644 --- a/sqlite-cloud/platform/_vector.mdx +++ b/sqlite-cloud/platform/_vector.mdx @@ -100,7 +100,7 @@ insert into vec_items_slim ``` ## Performance considerations -Free SQLite Cloud plans are not optimized for large-scale vector workloads. To speak to the team about upgrading your plan, [please reach out](https://www.sqlitecloud.io/support). +Free SQLite Cloud plans are not optimized for large-scale vector workloads. To speak to the team about upgrading your plan, please reach out. ## Next Steps Combined with [edge functions](/docs/edge-functions), SQLite Cloud's vector search capabilities make it a great choice for serverless RAG applications. diff --git a/sqlite-cloud/platform/access-tokens.mdx b/sqlite-cloud/platform/access-tokens.mdx index 3e62528..83664b7 100644 --- a/sqlite-cloud/platform/access-tokens.mdx +++ b/sqlite-cloud/platform/access-tokens.mdx @@ -8,13 +8,13 @@ slug: access-tokens Access Tokens let backend systems securely grant users, devices, tenants, etc. access to SQLite Cloud database and services (SQLite Sync, Weblite, etc.). These endpoints enable full token lifecycle management: creation, inspection, validation, update, and revocation. All endpoints require authentication. Use an **API Key** or an **Access Token** via the `Authorization` header. -The API Documentation for the Access Tokens API can be found in the **Weblite** section in the [Dashboard](https://dashboard.sqlitecloud.io). +The API Documentation for the Access Tokens API can be found in the **Weblite** section in the Dashboard. --- ## Example Using SQLite Cloud Access Tokens with Google Login -In the repository on GitHub [sqlitecloud/examples](https://github.com/sqlitecloud/examples/tree/main/access-tokens-and-social-login), we created a simple app to demonstrate how to generate and use Access Tokens. +In the repository on GitHub sqlitecloud/examples, we created a simple app to demonstrate how to generate and use Access Tokens. We’ll log in with Google, grab a token, and use it to interact with SQLite Cloud Weblite APIs. Here’s how it works. @@ -78,4 +78,4 @@ const res = await fetch("https:///v2/weblite/sql", { ... ``` -The result depends on the [Row Level Security](https://docs.sqlitecloud.io/docs/rls) policies you enabled for the tables. +The result depends on the [Row Level Security](rls) policies you enabled for the tables. diff --git a/sqlite-cloud/platform/backups.mdx b/sqlite-cloud/platform/backups.mdx index 73aebb9..6d7cacc 100644 --- a/sqlite-cloud/platform/backups.mdx +++ b/sqlite-cloud/platform/backups.mdx @@ -10,7 +10,7 @@ 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. +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 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. diff --git a/sqlite-cloud/platform/edge-functions.mdx b/sqlite-cloud/platform/edge-functions.mdx index 9525f23..8f08269 100644 --- a/sqlite-cloud/platform/edge-functions.mdx +++ b/sqlite-cloud/platform/edge-functions.mdx @@ -14,7 +14,7 @@ Edge functions let you define custom logic to run on the same nodes as your data You can write edge functions directly in the SQLite Cloud dashboard using JavaScript, TypeScript, or SQL. Importing modules is not currently supported. -Edge functions can be called remotely over HTTP or Websockets via API, or triggered by database events via SQLite Cloud [Webhooks](https://docs.sqlitecloud.io/docs/webhooks). Each function runs in an isolated environment using the Bun runtime. +Edge functions can be called remotely over HTTP or Websockets via API, or triggered by database events via SQLite Cloud Webhooks. Each function runs in an isolated environment using the Bun runtime. Turning on linearizable reads ensures strong consistency, but may introduce some latency. When eventual consistency is sufficient, we recommend leaving linearizable reads off. @@ -81,7 +81,7 @@ return { } ``` -Select the database you would like to access from the "Database" dropdown, or select the database you want to use in your SQL query with the [USE command](https://docs.sqlitecloud.io/docs/database-commands). +Select the database you would like to access from the "Database" dropdown, or select the database you want to use in your SQL query with the USE command. ```js const customers = await connection.sql`USE DATABASE chinook.sqlite; SELECT * FROM customers;`; @@ -94,10 +94,10 @@ return { Environment variables can be accessed and stored with the ENV command. ENV variables are stored in the server settings file and are project-specific. Use the following commands to set and read values in your server settings file: -* [LIST ENV](https://docs.sqlitecloud.io/docs/settings-commands#list-env) -* [SET ENV](https://docs.sqlitecloud.io/docs/settings-commands#set-env) key VALUE value -* [GET ENV](https://docs.sqlitecloud.io/docs/settings-commands#get-env) key -* [REMOVE ENV](https://docs.sqlitecloud.io/docs/settings-commands#remove-env) key +* LIST ENV +* SET ENV key VALUE value +* GET ENV key +* REMOVE ENV key You can also add environment variables in the UI by navigating to the "Environment Variables" section and clicking the "Create" button. diff --git a/sqlite-cloud/platform/extensions.mdx b/sqlite-cloud/platform/extensions.mdx index 6a958ea..8722cda 100644 --- a/sqlite-cloud/platform/extensions.mdx +++ b/sqlite-cloud/platform/extensions.mdx @@ -13,10 +13,10 @@ These extensions are available for use in your SQLite Cloud databases. - **[SQLite-Vector](sqlite-vector)**: High performance vector storage extension for similarity search. - **[SQLite-Sync](sqlite-sync)**: Local-first extension for true local-first data synchronization for your applications. - **[SQLite-JS](sqlite-js)**: Enables JavaScript integration in SQLite for executing server-side logic. -- **[Full-text Search 5](https://www.sqlite.org/fts5.html)**: Full-text search engine that allows you to search for text in a database. -- **[JSON1](https://www.sqlite.org/json1.html)**: Allows you to easily store, query, and manipulate JSON data. -- **[Math](https://www.sqlite.org/lang_mathfunc.html)**: Mathematical functions. -- **[RTree](https://www.sqlite.org/rtree.html)**: R-Tree index for storing and querying spatial data. -- **[Geopoly](https://www.sqlite.org/geopoly.html)**: A set of functions for working with geospatial data. For a complete guide, see the [comprehensive tutorial here](tutorial-geopoly). +- **Full-text Search 5**: Full-text search engine that allows you to search for text in a database. +- **JSON1**: Allows you to easily store, query, and manipulate JSON data. +- **Math**: Mathematical functions. +- **RTree**: R-Tree index for storing and querying spatial data. +- **Geopoly**: A set of functions for working with geospatial data. For a complete guide, see the [comprehensive tutorial here](tutorial-geopoly). -In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by [adding to this issue](https://github.com/sqlitecloud/docs/issues/34). \ No newline at end of file +In the future, we plan to allow users to install their own extensions. If you have a specific extension you would like to use, please let us know by adding to this issue. \ No newline at end of file diff --git a/sqlite-cloud/platform/offsync.mdx b/sqlite-cloud/platform/offsync.mdx index 410d83b..5b64c90 100644 --- a/sqlite-cloud/platform/offsync.mdx +++ b/sqlite-cloud/platform/offsync.mdx @@ -13,7 +13,7 @@ import devicesSync from '@docs-website-assets/introduction/video/dashboard_sync_ 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. +OffSync is a powerful SQLite Cloud feature that enables true **local-first** data synchronization for your applications. Powered by the 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. diff --git a/sqlite-cloud/platform/rls.mdx b/sqlite-cloud/platform/rls.mdx index 0d229bb..07bc7f4 100644 --- a/sqlite-cloud/platform/rls.mdx +++ b/sqlite-cloud/platform/rls.mdx @@ -18,7 +18,7 @@ Row-Level Security (RLS) allows you to define fine-grained access control polici RLS rules only affect users who are authenticated using [Access Tokens](/docs/access-tokens). Admins, APIKEYs, or other non-token users are not restricted by RLS. -RLS is a powerful feature for building secure, multi-tenant applications. When combined with [SQLite Sync](https://github.com/sqliteai/sqlite-sync), it enables you to create robust **local-first apps** where user data is stored on the device for offline availability and superior performance. +RLS is a powerful feature for building secure, multi-tenant applications. When combined with SQLite Sync, it enables you to create robust **local-first apps** where user data is stored on the device for offline availability and superior performance. 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. @@ -73,7 +73,7 @@ To help you create dynamic RLS policies, SQLite Cloud provides two functions to These functions are particularly useful for creating policies that are based on user attributes. -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/). +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. ### OLD and NEW References @@ -260,7 +260,7 @@ This policy uses the `OLD` reference to check the value of the `status` column * ## Advanced: RLS and SQLite Sync -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. +When using RLS in conjunction with 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. To accommodate this, SQLite Cloud offers two modes for handling RLS during sync operations, configurable via the `rls_mode` server setting using the SQLite Cloud builtin command `SET KEY rls_mode TO `. diff --git a/sqlite-cloud/platform/security.mdx b/sqlite-cloud/platform/security.mdx index 57a6a3e..961c842 100644 --- a/sqlite-cloud/platform/security.mdx +++ b/sqlite-cloud/platform/security.mdx @@ -34,7 +34,7 @@ There are two types of roles in SQLite Cloud: ### Built-in roles import Callout from "@commons-components/Information/Callout.astro"; -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. +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 command, and custom roles can be created with the CREATE ROLE command. Privileges represent fundamental operations that can be executed on specific databases or tables and can be granted, revoked, or assigned to specific roles. Here is an overview of the built-in roles: @@ -60,7 +60,7 @@ Here is an overview of the built-in roles: -To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/role-commands), [GRANT ROLE](/docs/role-commands), [GRANT PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) and [SET PRIVILEGE](https://docs.sqlitecloud.io/docs/privilege-commands) commands, as well as during the [CREATE USER](https://docs.sqlitecloud.io/docs/user-commands) command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. +To further refine the scope of a role or privilege, you can specify a database and table name during the [CREATE ROLE](/docs/role-commands), [GRANT ROLE](/docs/role-commands), GRANT PRIVILEGE and SET PRIVILEGE commands, as well as during the CREATE USER command. If `NULL` is used, it means that the role or privilege is not assigned and cannot function without specifying a database and table name combination. To extend the validity to any database and table, you can utilize the special `*` character. ```bash @@ -100,7 +100,7 @@ In a role-based access control system, a privilege represents a specific action It defines what a user can or cannot do, such as reading, writing, or managing certain resources like tables, databases, or settings. Essentially, a privilege is a **right** or **ability** granted to a user or role, specifying their level of access and control over the system's resources. -A privilege can be [granted](https://docs.sqlitecloud.io/docs/privilege-commands), [revoked](https://docs.sqlitecloud.io/docs/privilege-commands) and [assigned](https://docs.sqlitecloud.io/docs/privilege-commands) to a given role. +A privilege can be granted, revoked and assigned to a given role. A role can contains any combination of privileges. ```bash @@ -152,7 +152,7 @@ A role can contains any combination of privileges. {/* ## IP Restrictions -The IP Restrictions panel enables the restriction of access for a role or user by allowing only specific IP addresses or ranges in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) (for example 10.10.10.0/24). Both IPv4 and IPv6 addresses are supported. +The IP Restrictions panel enables the restriction of access for a role or user by allowing only specific IP addresses or ranges in CIDR notation (for example 10.10.10.0/24). Both IPv4 and IPv6 addresses are supported. To add a new IP restriction to a user or role, click on the **Add IP** button. diff --git a/sqlite-cloud/platform/webhooks.mdx b/sqlite-cloud/platform/webhooks.mdx index 72b610e..2b00f2a 100644 --- a/sqlite-cloud/platform/webhooks.mdx +++ b/sqlite-cloud/platform/webhooks.mdx @@ -20,7 +20,7 @@ import webhooksEdgeFunction from '@docs-website-assets/introduction/video/dashbo Use the **Webhooks panel** to effortlessly create real-time notifications for write operations—such as inserts, updates, or deletes—within your SQLite Cloud database. -For example, you can configure SQLite Cloud to notify a [webhook.site](https://webhook.site) endpoint every time a write operation occurs on the `albums` table of the `chinook.sqlite` database. +For example, you can configure SQLite Cloud to notify a webhook.site endpoint every time a write operation occurs on the `albums` table of the `chinook.sqlite` database. diff --git a/sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx b/sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx index 97bc674..06397bf 100644 --- a/sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx +++ b/sqlite-cloud/quickstart/quick-start-apollo-graphql.mdx @@ -9,7 +9,7 @@ slug: quick-start-apollo-graphql In this quickstart, we will show you how to get started with SQLite Cloud and Apollo/GraphQL by writing a simple GraphQL wrapper around a SQLite Cloud database connection. 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Install the necessary dependencies** @@ -184,4 +184,4 @@ mutation { And that's it! You've successfully built an Apollo/GraphQL server that reads and writes data to a SQLite Cloud database. -For the full code example, see the [SQLite Cloud Apollo/GraphQL example repo](https://github.com/sqlitecloud/examples/tree/main/graphql-apollo/server). +For the full code example, see the SQLite Cloud Apollo/GraphQL example repo. diff --git a/sqlite-cloud/quickstart/quick-start-cdn.mdx b/sqlite-cloud/quickstart/quick-start-cdn.mdx index 97b093b..39a7fc5 100644 --- a/sqlite-cloud/quickstart/quick-start-cdn.mdx +++ b/sqlite-cloud/quickstart/quick-start-cdn.mdx @@ -11,7 +11,7 @@ In this quickstart, we demonstrate how to locally serve the SQLite Cloud JS Driv --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a JavaScript / TypeScript app** diff --git a/sqlite-cloud/quickstart/quick-start-django.mdx b/sqlite-cloud/quickstart/quick-start-django.mdx index 1a43cae..8d467b6 100644 --- a/sqlite-cloud/quickstart/quick-start-django.mdx +++ b/sqlite-cloud/quickstart/quick-start-django.mdx @@ -9,11 +9,11 @@ slug: quick-start-django In this quickstart, we will show you how to get started with SQLite Cloud and Django by building a simple application that connects to and reads from a SQLite Cloud database. 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Django app** - - If you haven't already done so, [install Python and Django](https://docs.djangoproject.com/en/5.0/intro/install/). + - If you haven't already done so, install Python and Django. - The following command creates an outer directory (the container for your project) AND an inner directory (the Python package for your project). Both directories will be named `sqlitecloud_quickstart`. ```bash @@ -149,7 +149,7 @@ python manage.py runserver This Quickstart goes a bit deeper into the framework than the other Quickstarts since Django requires more boilerplate to get up-and-running with a simple app. If you're new to Django and want to learn more, we referenced the following Django Tutorial pages extensively when writing this Quickstart: - - [Part 1](https://docs.djangoproject.com/en/5.0/intro/tutorial01) - - [Part 3](https://docs.djangoproject.com/en/5.0/intro/tutorial03) + - Part 1 + - Part 3 And that's it! You've successfully built a Django app that reads data from a SQLite Cloud database. \ No newline at end of file diff --git a/sqlite-cloud/quickstart/quick-start-flask.mdx b/sqlite-cloud/quickstart/quick-start-flask.mdx index 392091b..dfe33ec 100644 --- a/sqlite-cloud/quickstart/quick-start-flask.mdx +++ b/sqlite-cloud/quickstart/quick-start-flask.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Fl --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Flask app** diff --git a/sqlite-cloud/quickstart/quick-start-gin.mdx b/sqlite-cloud/quickstart/quick-start-gin.mdx index 58eeae6..655f381 100644 --- a/sqlite-cloud/quickstart/quick-start-gin.mdx +++ b/sqlite-cloud/quickstart/quick-start-gin.mdx @@ -11,11 +11,11 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Go --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new database. + - If you haven't already, sign up for a SQLite Cloud account and create a new database. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Gin app** - - You should have [Go installed](https://go.dev/doc/install) locally. + - You should have Go installed locally. - Set up your Go workspace. ```bash mkdir sqlc-quickstart diff --git a/sqlite-cloud/quickstart/quick-start-knex.mdx b/sqlite-cloud/quickstart/quick-start-knex.mdx index 74a3bd9..ef52c05 100644 --- a/sqlite-cloud/quickstart/quick-start-knex.mdx +++ b/sqlite-cloud/quickstart/quick-start-knex.mdx @@ -6,14 +6,14 @@ status: publish slug: quick-start-knex --- -In this tutorial, we'll show you how to connect your TypeScript application to a SQLite Cloud database using the popular SQL builder, [Knex.js](https://knexjs.org/). +In this tutorial, we'll show you how to connect your TypeScript application to a SQLite Cloud database using the popular SQL builder, Knex.js. --- **Prerequisites** - Node.js and npm installed on your system -- A SQLite Cloud account (you can sign up for a free account [here](https://dashboard.sqlitecloud.io/auth/sign-in)) +- A SQLite Cloud account (you can sign up for a free account here) 1. **How to connect** diff --git a/sqlite-cloud/quickstart/quick-start-laravel.mdx b/sqlite-cloud/quickstart/quick-start-laravel.mdx index 2442e2b..f2ee817 100644 --- a/sqlite-cloud/quickstart/quick-start-laravel.mdx +++ b/sqlite-cloud/quickstart/quick-start-laravel.mdx @@ -11,12 +11,12 @@ In this quickstart, we will show you how to get started with SQLite Cloud and PH --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Laravel app** - If you haven't already done so, install PHP, Laravel, and Composer. - - If you use macOS, you can install all 3 in 1 click by [downloading Laravel Herd](https://herd.laravel.com/docs/1/getting-started/installation#installation), a PHP dev environment. + - If you use macOS, you can install all 3 in 1 click by downloading Laravel Herd, a PHP dev environment. - Create a new Laravel project. ```bash @@ -141,7 +141,7 @@ class AlbumController extends Controller This Quickstart goes a bit deeper into the framework than the other Quickstarts since Laravel requires more boilerplate to get up-and-running with a simple app. If you're new to Laravel and want to learn more, we referenced the following Laravel Tutorial pages extensively when writing this Quickstart: - - [Installation](https://bootcamp.laravel.com/blade/installation) - - [Controllers, Routing, Blade](https://bootcamp.laravel.com/blade/creating-chirps) + - Installation + - Controllers, Routing, Blade And that's it! You've successfully built a PHP / Laravel app that reads data from a SQLite Cloud database. \ No newline at end of file diff --git a/sqlite-cloud/quickstart/quick-start-next.mdx b/sqlite-cloud/quickstart/quick-start-next.mdx index 905e552..4636cf2 100644 --- a/sqlite-cloud/quickstart/quick-start-next.mdx +++ b/sqlite-cloud/quickstart/quick-start-next.mdx @@ -11,7 +11,7 @@ This quick start guide will walk you through setting up a Next.js application th --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - For this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** diff --git a/sqlite-cloud/quickstart/quick-start-node.mdx b/sqlite-cloud/quickstart/quick-start-node.mdx index d68a932..419a0af 100644 --- a/sqlite-cloud/quickstart/quick-start-node.mdx +++ b/sqlite-cloud/quickstart/quick-start-node.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and No --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Node.js app** - Navigate to your target directory and run the following command to initialize your Node.js app and install the necessary depedencies: diff --git a/sqlite-cloud/quickstart/quick-start-prisma.mdx b/sqlite-cloud/quickstart/quick-start-prisma.mdx index cda146a..f0fb1c5 100644 --- a/sqlite-cloud/quickstart/quick-start-prisma.mdx +++ b/sqlite-cloud/quickstart/quick-start-prisma.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Pr --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Next.js app** - Create a Next app using ```create-next-app```. The following command creates a very simple app (JS, no Tailwind, uses the latest App Router) to keep the focus on querying the data. diff --git a/sqlite-cloud/quickstart/quick-start-react-native.mdx b/sqlite-cloud/quickstart/quick-start-react-native.mdx index b3e59cc..8ba114f 100644 --- a/sqlite-cloud/quickstart/quick-start-react-native.mdx +++ b/sqlite-cloud/quickstart/quick-start-react-native.mdx @@ -11,11 +11,11 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React Native project** - - If you haven't already, [sign up for an Expo account](https://expo.dev/). + - If you haven't already, sign up for an Expo account. - Create a new remote EAS project with the name `sqlc-quickstart`. - Link your remote project to a new local project. Replace `{id}` below with the project ID provided by Expo. diff --git a/sqlite-cloud/quickstart/quick-start-react.mdx b/sqlite-cloud/quickstart/quick-start-react.mdx index 51fcb77..696b4b6 100644 --- a/sqlite-cloud/quickstart/quick-start-react.mdx +++ b/sqlite-cloud/quickstart/quick-start-react.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and Re --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a React app** - Create a React app using a Vite template diff --git a/sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx b/sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx index 736e249..9a723c7 100644 --- a/sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx +++ b/sqlite-cloud/quickstart/quick-start-sqlalchemy-orm.mdx @@ -16,7 +16,7 @@ NOTE that FastAPI framework: --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a new Python project** @@ -160,8 +160,8 @@ AttributeError: module 'sqlitecloud.dbapi2' has no attribute 'sqlite_version_inf 7. **References** - - [FastAPI introductory example](https://fastapi.tiangolo.com/#example) - - [FastAPI SQL Databases tutorial](https://fastapi.tiangolo.com/tutorial/sql-databases/) - - [Latest SQLAlchemy docs](https://docs.sqlalchemy.org/en/20/) + - FastAPI introductory example + - FastAPI SQL Databases tutorial + - Latest SQLAlchemy docs And that's it! You've successfully built a FastAPI app that uses SQLAlchemy ORM to read data from a SQLite Cloud database. diff --git a/sqlite-cloud/quickstart/quick-start-streamlit.mdx b/sqlite-cloud/quickstart/quick-start-streamlit.mdx index 7eab3cd..634c735 100644 --- a/sqlite-cloud/quickstart/quick-start-streamlit.mdx +++ b/sqlite-cloud/quickstart/quick-start-streamlit.mdx @@ -11,7 +11,7 @@ In this quickstart, we will show you how to get started with SQLite Cloud and St --- 1. **Set up a SQLite Cloud account** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In this guide, we will use the sample datasets that come pre-loaded with SQLite Cloud. 2. **Create a Streamlit app** diff --git a/sqlite-cloud/reference/api-key-commands.mdx b/sqlite-cloud/reference/api-key-commands.mdx index 8e4baa7..1d37cbb 100644 --- a/sqlite-cloud/reference/api-key-commands.mdx +++ b/sqlite-cloud/reference/api-key-commands.mdx @@ -8,7 +8,7 @@ slug: api-key-commands ## CREATE APIKEY USER The CREATE APIKEY USER command creates a new APIKEY associated to a specific username and with a mnemonic name. The RESTRICTION option is currently unused and an expiration date can be set using the EXPIRATION parameter. -It returns a [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the new APIKEY. +It returns a String with the new APIKEY. ### Syntax ```bash @@ -22,7 +22,7 @@ USERADMIN ## LIST APIKEYS The LIST APIKEYS command retrieves all the APIKEYS created on the server. The USER parameter can be used to filter the result further. -It returns a [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +It returns a Rowset with the following columns: * **username**: user name * **key**: API KEY * **name**: mnemonic name @@ -41,7 +41,7 @@ USERADMIN ## LIST MY APIKEYS The LIST MY APIKEYS command returns a list of all the APIKEYs associated with the username used in the current connection. -It returns a [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +It returns a Rowset with the following columns: * **username**: user name * **key**: API KEY * **name**: mnemonic name @@ -60,7 +60,7 @@ USERADMIN ## SET APIKEY The SET KEY command sets or updates a **keyname** to a specific **keyvalue**. Once set, the server immediately uses the updated value (and automatically distributes it on the cluster). -It returns OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +It returns OK string or error value (see SCSP protocol). ### Syntax @@ -75,7 +75,7 @@ SETTINGS ## REMOVE APIKEY The REMOVE APIKEY command permanently removes an APIKEY from the server. -It returns OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +It returns OK string or error value (see SCSP protocol). ### Syntax diff --git a/sqlite-cloud/reference/auth-commands.mdx b/sqlite-cloud/reference/auth-commands.mdx index 3c1feff..a4250ab 100644 --- a/sqlite-cloud/reference/auth-commands.mdx +++ b/sqlite-cloud/reference/auth-commands.mdx @@ -22,4 +22,4 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). diff --git a/sqlite-cloud/reference/backup-commands.mdx b/sqlite-cloud/reference/backup-commands.mdx index 3ee1271..9c3138e 100644 --- a/sqlite-cloud/reference/backup-commands.mdx +++ b/sqlite-cloud/reference/backup-commands.mdx @@ -7,7 +7,7 @@ slug: backup-commands --- ## APPLY BACKUP SETTINGS -Several backup-related settings can be applied using the [SET DATABASE KEY](https://docs.sqlitecloud.io/docs/settings-commands#set-database-key) command. +Several backup-related settings can be applied using the SET DATABASE KEY command. The following keys affect the backup settings: * **backup**: set to 1 to activate a backup, 0 to disable. @@ -28,7 +28,7 @@ BACKUP ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ## LIST BACKUP SETTINGS @@ -49,7 +49,7 @@ BACKUP ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **name**: database name * **enabled**: 1 enabled, 0 disabled * **backup_retention**: retention period @@ -91,7 +91,7 @@ BACKUP ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **type**: can be snapshot or wal * **replica**: always S3 in this version * **generation**: backup generation ID @@ -145,7 +145,7 @@ BACKUP ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with a single **name** column that returns all the databases with backup enabled. +A Rowset with a single **name** column that returns all the databases with backup enabled. ### Example @@ -172,7 +172,7 @@ RESTORE BACKUP DATABASE **database_name** [GENERATION **generation**] [INDEX **i ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Privileges diff --git a/sqlite-cloud/reference/cli-commands.mdx b/sqlite-cloud/reference/cli-commands.mdx index fa65182..197ba0a 100644 --- a/sqlite-cloud/reference/cli-commands.mdx +++ b/sqlite-cloud/reference/cli-commands.mdx @@ -10,9 +10,9 @@ The **SQLite Cloud Command Line Interface** is a user-friendly interface that ru It's worth noting that there are two versions of the CLI available: one written in C and one written in GO. Both versions offer the same functionality, and the source code is provided for both. The C version was the first to be developed and was extensively used during the development of SQLite Cloud. It's based on the C SDK. The GO version, on the other hand, was created later, after the GO SDK was released. In the future, we plan to combine both projects into a unified CLI. -* Binaries can be downloaded from [GitHub](https://github.com/sqlitecloud/sdk/releases). -* C source code can be downloaded from the [C SDK repo](https://github.com/sqlitecloud/sdk/tree/master/C). -* GO source code can be downlaoded from the [GO SDK repo](https://github.com/sqlitecloud/sqlitecloud-go). +* Binaries can be downloaded from GitHub. +* C source code can be downloaded from the C SDK repo. +* GO source code can be downlaoded from the GO SDK repo. The C cli (sqlitecloud-cli) is available for Linux (x86) and macOS (Intel and ARM). diff --git a/sqlite-cloud/reference/cluster-commands.mdx b/sqlite-cloud/reference/cluster-commands.mdx index f7f9bb0..00c3680 100644 --- a/sqlite-cloud/reference/cluster-commands.mdx +++ b/sqlite-cloud/reference/cluster-commands.mdx @@ -20,8 +20,8 @@ CLUSTERADMIN, CLUSTERMONITOR ### Return -A [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) containing the IP address and port of the leader. -If the ID parameter is specified then the [Integer](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) nodeID of the leader node is returned. +A String containing the IP address and port of the leader. +If the ID parameter is specified then the Integer nodeID of the leader node is returned. ### Example @@ -49,7 +49,7 @@ CLUSTERADMIN, CLUSTERMONITOR ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **id**: node ID * **node**: public node DNS name and port * **cluster**: DNS name and port used for Raft intra-node communication @@ -88,7 +88,7 @@ CLUSTERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/database-commands.mdx b/sqlite-cloud/reference/database-commands.mdx index 0ac9aae..ed15ea1 100644 --- a/sqlite-cloud/reference/database-commands.mdx +++ b/sqlite-cloud/reference/database-commands.mdx @@ -26,7 +26,7 @@ CREATE_DATABASE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -55,7 +55,7 @@ CREATE_DATABASE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -80,7 +80,7 @@ DBADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -105,7 +105,7 @@ CREATE_DATABASE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -130,8 +130,8 @@ HOSTADMIN ### Return -An [Integer](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) if **key** is ID or SIZE. -A [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) if **key** is NAME. +An Integer if **key** is ID or SIZE. +A String if **key** is NAME. ### Example @@ -166,7 +166,7 @@ PRAGMA ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **key**: database key * **value**:database value @@ -198,7 +198,7 @@ NONE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with only the column **name** if the DETAILED flag is omitted, otherwise several other columns: +A Rowset with only the column **name** if the DETAILED flag is omitted, otherwise several other columns: * **name**: database name * **size**: database size (in bytes) * **connections**: number of clients connected to the database @@ -249,7 +249,7 @@ HOSTADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **id**: client ID * **address**: client IP address * **username**: username of the connected client @@ -287,7 +287,7 @@ DROP_DATABASE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -312,7 +312,7 @@ PRIVILEGE_DBADMIN or PRIVILEGE_PUBSUB, which means that the USE DATABASE command ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -337,7 +337,7 @@ READWRITE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/general-commands.mdx b/sqlite-cloud/reference/general-commands.mdx index 9cb7cec..84bd73e 100644 --- a/sqlite-cloud/reference/general-commands.mdx +++ b/sqlite-cloud/reference/general-commands.mdx @@ -22,7 +22,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -54,7 +54,7 @@ CLUSTERADMIN, CLUSTERMONITOR ### Return -A single value (usually a [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md)) that depends on the input **key**. +A single value (usually a String) that depends on the input **key**. ### Example @@ -79,7 +79,7 @@ READWRITE ### Return -A [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) set to the CREATE TABLE sql statement. +A String set to the CREATE TABLE sql statement. ### Example @@ -104,7 +104,7 @@ NONE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **command**: command syntax * **count**: how many times the command was executed * **avgtime**: average command execution time @@ -160,7 +160,7 @@ USERADMIN, HOSTADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **id**: unique connection (client) ID * **address**: source connection IP address * **username**: username used to authenticate the connection @@ -196,7 +196,7 @@ READWRITE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **name**: index name * **tbl_name**: table name @@ -236,7 +236,7 @@ CLUSTERADMIN, CLUSTERMONITOR ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **key**: server key * **value**: server value @@ -307,7 +307,7 @@ READWRITE, DBADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with one **key** column that returns all the reserved SQLite keywords. +A Rowset with one **key** column that returns all the reserved SQLite keywords. ### Example @@ -482,7 +482,7 @@ READWRITE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with several columns that depends on the filters used in the command. The output is similar to the one obtains by calling the [sqlite3_table_column_metadata](https://www.sqlite.org/c3ref/table_column_metadata.html) API. +A Rowset with several columns that depends on the filters used in the command. The output is similar to the one obtains by calling the sqlite3_table_column_metadata API. ### Example @@ -589,7 +589,7 @@ READWRITE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **schema**: database schema name * **name**: table name * **type**: always 'table' in this version @@ -636,7 +636,7 @@ CLUSTERADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **datetime**: the data time of the stat * **key**: stat name * **value**: stat value @@ -710,7 +710,7 @@ NONE ### Return -It returns the "PONG" [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md). +It returns the "PONG" String. ### Example @@ -735,7 +735,7 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/ip-commands.mdx b/sqlite-cloud/reference/ip-commands.mdx index ceb40a7..14baf4c 100644 --- a/sqlite-cloud/reference/ip-commands.mdx +++ b/sqlite-cloud/reference/ip-commands.mdx @@ -21,7 +21,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -46,10 +46,10 @@ USERADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **address**: IP address(es) allowed * **name**: user name or role name -* **type**: user or role [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) +* **type**: user or role String ### Example @@ -79,7 +79,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/log-commands.mdx b/sqlite-cloud/reference/log-commands.mdx index 8e4eafc..e12e027 100644 --- a/sqlite-cloud/reference/log-commands.mdx +++ b/sqlite-cloud/reference/log-commands.mdx @@ -45,9 +45,9 @@ HOSTADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: `datetime`, `log_type`, `log_level, `description`, `username`, `database`, `ip_address`, `connection_id`. +A Rowset with the following columns: `datetime`, `log_type`, `log_level, `description`, `username`, `database`, `ip_address`, `connection_id`. -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **datetime**: log entry date and time * **log_type**: log type (a number from 1 to 8, see description) * **log_level**: log level (a number from 0 to 5, see description) diff --git a/sqlite-cloud/reference/plugin-commands.mdx b/sqlite-cloud/reference/plugin-commands.mdx index 69d5476..f657ef0 100644 --- a/sqlite-cloud/reference/plugin-commands.mdx +++ b/sqlite-cloud/reference/plugin-commands.mdx @@ -22,7 +22,7 @@ PLUGIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -47,7 +47,7 @@ PLUGIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -72,7 +72,7 @@ PLUGIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **name**: plugin name * **type**: plugin type (SQLite or SQLiteCloud) * **enabled**: 1 enabled, 0 disabled @@ -120,7 +120,7 @@ PLUGIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/privilege-commands.mdx b/sqlite-cloud/reference/privilege-commands.mdx index 688e91f..4b6b3d5 100644 --- a/sqlite-cloud/reference/privilege-commands.mdx +++ b/sqlite-cloud/reference/privilege-commands.mdx @@ -21,7 +21,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -46,7 +46,7 @@ USERADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with one privilege **name** column. +A Rowset with one privilege **name** column. ### Example @@ -110,7 +110,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -135,7 +135,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/pub-sub-commands.mdx b/sqlite-cloud/reference/pub-sub-commands.mdx index 6cc61aa..6777d8f 100644 --- a/sqlite-cloud/reference/pub-sub-commands.mdx +++ b/sqlite-cloud/reference/pub-sub-commands.mdx @@ -22,7 +22,7 @@ PUBSUBCREATE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -48,7 +48,7 @@ PUBSUB ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with a single **chname** column that returns all channels created for Pub/Sub. +A Rowset with a single **chname** column that returns all channels created for Pub/Sub. ### Example @@ -88,7 +88,7 @@ SUB ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -112,7 +112,7 @@ PUB ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -137,7 +137,7 @@ PUBSUBCREATE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -165,7 +165,7 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/query-analyzer-commands.mdx b/sqlite-cloud/reference/query-analyzer-commands.mdx index e708e98..4de10d6 100644 --- a/sqlite-cloud/reference/query-analyzer-commands.mdx +++ b/sqlite-cloud/reference/query-analyzer-commands.mdx @@ -21,7 +21,7 @@ DBADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with an analysis about the query id. +A Rowset with an analysis about the query id. ### Example @@ -51,7 +51,7 @@ DBADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -79,7 +79,7 @@ DBADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **statement**: reference to original statement (when multiple suggestions are returned) * **type**: 1 means SQL, 2 means INDEX, 3 means PLAN and 4 means CANDIDATE * **report**: sql or suggestion computed by the SQLite engine @@ -116,7 +116,7 @@ DBADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with columns that depend on the command flags. +A Rowset with columns that depend on the command flags. ### Example diff --git a/sqlite-cloud/reference/role-commands.mdx b/sqlite-cloud/reference/role-commands.mdx index 4906acc..2dd78ce 100644 --- a/sqlite-cloud/reference/role-commands.mdx +++ b/sqlite-cloud/reference/role-commands.mdx @@ -23,7 +23,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -48,7 +48,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -73,7 +73,7 @@ USERADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **rolename**: the name of the role * **builtin**: 1 if it is a built-in role, 0 otherwise * **privileges**: a comma separated list of privileges associated to the role @@ -125,7 +125,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -150,7 +150,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -175,7 +175,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/settings-commands.mdx b/sqlite-cloud/reference/settings-commands.mdx index c7999ec..9ab989e 100644 --- a/sqlite-cloud/reference/settings-commands.mdx +++ b/sqlite-cloud/reference/settings-commands.mdx @@ -21,7 +21,7 @@ NONE ### Return -A single value (usually a [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md)) that depends on the input **keyname**. +A single value (usually a String) that depends on the input **keyname**. ### Example @@ -49,7 +49,7 @@ PRAGMA ### Return -A [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the requested value. +A String with the requested value. ### Example @@ -74,7 +74,7 @@ SETTINGS ### Return -A single value (usually a [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md)) that depends on the input **keyname**. +A single value (usually a String) that depends on the input **keyname**. ### Example @@ -102,7 +102,7 @@ NONE ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **key**: client key * **value**: client value @@ -146,7 +146,7 @@ SETTINGS ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **key**: settings key * **value**: settings value * **default_value**: default value @@ -202,7 +202,7 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -227,7 +227,7 @@ PRAGMA ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -252,7 +252,7 @@ SETTINGS ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -277,7 +277,7 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -306,7 +306,7 @@ PRAGMA ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -331,7 +331,7 @@ SETTINGS ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/reference/user-commands.mdx b/sqlite-cloud/reference/user-commands.mdx index 00ffeb8..4d97509 100644 --- a/sqlite-cloud/reference/user-commands.mdx +++ b/sqlite-cloud/reference/user-commands.mdx @@ -21,7 +21,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -47,7 +47,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -72,7 +72,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -97,7 +97,7 @@ NONE ### Return -A [String](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) set to the current username. +A String set to the current username. ### Example @@ -122,7 +122,7 @@ USERADMIN ### Return -A [Rowset](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) with the following columns: +A Rowset with the following columns: * **username**: user name * **enabled**: 1 enabled, 0 disabled * **roles**: list of roles @@ -165,7 +165,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -190,7 +190,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -215,7 +215,7 @@ NONE ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example @@ -240,7 +240,7 @@ USERADMIN ### Return -OK string or error value (see [SCSP](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md) protocol). +OK string or error value (see SCSP protocol). ### Example diff --git a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx index 4d174d2..9985677 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobBytes.mdx @@ -13,7 +13,7 @@ int SQCloudBlobBytes (SQCloudBlob *blob); This function returns the size in bytes of the BLOB accessible via the successfully opened BLOB handle in its only argument. The incremental blob I/O routines can only read or overwriting existing blob content; they cannot change the size of a blob. -This function resembles the [sqlite3_blob_bytes](https://www.sqlite.org/c3ref/blob_bytes.html) SQLite API. +This function resembles the sqlite3_blob_bytes SQLite API. ### Parameters * **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) diff --git a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx index 8c6b023..4040283 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobClose.mdx @@ -10,7 +10,7 @@ bool SQCloudBlobClose (SQCloudBlob *blob); ``` ### Description -This function closes an open BLOB handle. The BLOB handle is closed unconditionally. Even if this routine returns an error code, the handle is still closed. This function resembles the [sqlite3_blob_close](https://www.sqlite.org/c3ref/blob_close.html) SQLite API. +This function closes an open BLOB handle. The BLOB handle is closed unconditionally. Even if this routine returns an error code, the handle is still closed. This function resembles the sqlite3_blob_close SQLite API. ### Parameters * **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) diff --git a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx index eb4536c..d5cf26b 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobOpen.mdx @@ -22,7 +22,7 @@ This function fails if any of the following conditions are true: * Column **colname** is part of an index, PRIMARY KEY or UNIQUE constraint and the blob is being opened for read/write access * Foreign key constraints are enabled, column **colname** is part of a child key definition and the blob is being opened for read/write access -This function resembles the [sqlite3_blob_open](https://www.sqlite.org/c3ref/blob_open.html) SQLite API. +This function resembles the sqlite3_blob_open SQLite API. ### Parameters * **connection**: a valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) diff --git a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx index 9f17a4c..bf827c1 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobReOpen.mdx @@ -12,7 +12,7 @@ bool SQCloudBlobReOpen (SQCloudBlob *blob, int64_t rowid); ### Description This function is used to move an existing BLOB handle so that it points to a different row of the same database table. The new row is identified by the **rowid** value passed as the second argument. Only the row can be changed. The database, table and column on which the blob handle is open remain the same. -This function resembles the [sqlite3_blob_reopen](https://www.sqlite.org/c3ref/blob_reopen.html) SQLite API. +This function resembles the sqlite3_blob_reopen SQLite API. ### Parameters * **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) diff --git a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx index 52f2627..0ec896a 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobRead.mdx @@ -12,7 +12,7 @@ int SQCloudBlobRead (SQCloudBlob *blob, void *buffer, int blen, int offset); ### Description The **SQCloudBlobRead** function is used to read data from an open BLOB handle into a caller-supplied buffer. **blen** bytes of data are copied into buffer **buffer** from the open BLOB, starting at offset **offset**. -This function resembles the [sqlite3_blob_read](https://www.sqlite.org/c3ref/blob_read.html) SQLite API. +This function resembles the sqlite3_blob_read SQLite API. ### Parameters * **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) diff --git a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx index e947e75..d42ee93 100644 --- a/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx +++ b/sqlite-cloud/sdks/c/SQCloudBlobWrite.mdx @@ -13,7 +13,7 @@ int SQCloudBlobWrite (SQCloudBlob *blob, const void *buffer, int blen, int offse The **SQCloudBlobWrite** function is used to write data into an open BLOB handle from a caller-supplied buffer. **blen** bytes of data are copied from the buffer **buffer**into the open BLOB, starting at offset **offset**. -This function resembles the [sqlite3_blob_write](https://www.sqlite.org/c3ref/blob_write.html) SQLite API. +This function resembles the sqlite3_blob_write SQLite API. ### Parameters * **blob**: a valid SQCloudBlob opaque datatype obtained by [SQCloudBlobOpen](/docs/sqlite-cloud/sdks/c/sqcloudblobopen) diff --git a/sqlite-cloud/sdks/c/SQCloudError.mdx b/sqlite-cloud/sdks/c/SQCloudError.mdx index a261548..5d140b3 100644 --- a/sqlite-cloud/sdks/c/SQCloudError.mdx +++ b/sqlite-cloud/sdks/c/SQCloudError.mdx @@ -16,7 +16,7 @@ const char *SQCloudErrorMsg (SQCloudConnection *connection); ### Description If the most recent API call associated with with database connection failed, then this APIs return information about the error. -These functions resemble the [sqlite3_error_*](https://www.sqlite.org/c3ref/errcode.html) SQLite APIs. +These functions resemble the sqlite3_error_* SQLite APIs. ### Parameters @@ -26,7 +26,7 @@ These functions resemble the [sqlite3_error_*](https://www.sqlite.org/c3ref/errc * **SQLiteIsError** returns `true` if the most recent API call failed. * **SQCloudIsSQLiteError** returns `true` if the most recent error is related to an SQLite operation. * **SQCloudErrorCode** returns the numeric error code (or 0 if no error). -* **SQCloudExtendedErrorCode** returns the numeric [extended error code](https://www.sqlite.org/rescode.html#extrc) related to the failed SQLite operation. +* **SQCloudExtendedErrorCode** returns the numeric extended error code related to the failed SQLite operation. * **SQCloudErrorOffset** returns the byte offset of the start of the most recent error references a specific token in the input SQL (if any). If the most recent error does not reference a specific token in the input SQL, then the **SQCloudErrorOffset** function returns -1. * **SQCloudErrorMsg** return English-language text that describes the error. diff --git a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx index 9f2667b..5bdb369 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBind.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBind.mdx @@ -25,7 +25,7 @@ In the SQL statement text input to [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/ * $VVV In the templates above, NNN represents an integer literal, and VVV represents an alphanumeric identifier. The values of these parameters can be set using the SQCloudVMBind*() routines defined here. -These functions resemble the [sqlite3_bind_*](https://www.sqlite.org/c3ref/bind_blob.html) SQLite APIs. +These functions resemble the sqlite3_bind_* SQLite APIs. ### Parameters diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx index 00f7374..f1b5e47 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterCount.mdx @@ -12,7 +12,7 @@ int SQCloudVMBindParameterCount (SQCloudVM *vm); ### Description This routine can be used to find the number of SQL parameters in a prepared statement. SQL parameters are tokens of the form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as placeholders for values that are bound to the parameters at a later time. This routine actually returns the index of the largest (rightmost) parameter. For all forms except ?NNN, this will correspond to the number of unique parameters. If parameters of the ?NNN form are used, there may be gaps in the list. -This function resembles the [bind_parameter_count](https://www.sqlite.org/c3ref/bind_parameter_count.html) SQLite API. +This function resembles the bind_parameter_count SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx index 2b16c71..0ba61e5 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterIndex.mdx @@ -12,7 +12,7 @@ int SQCloudVMBindParameterIndex (SQCloudVM *vm, const char *name); ### Description Return the index of an SQL parameter given its name. The index value returned is suitable for use as the second parameter to [SQCloudVMBind](/docs/sqlite-cloud/sdks/c/sqcloudvmbind). A zero is returned if no matching parameter is found. -This function resembles the [bind_parameter_index](https://www.sqlite.org/c3ref/bind_parameter_index.html) SQLite API. +This function resembles the bind_parameter_index SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx index f595bf7..78a47a0 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMBindParameterName.mdx @@ -15,7 +15,7 @@ The **SQCloudVMBindParameterName** interface returns the name of the N-th SQL pa The first host parameter has an index of 1, not 0. If the value of index is out of range or if the N-th parameter is nameless, then NULL is returned. -This function resembles the [bind_parameter_name](https://www.sqlite.org/c3ref/bind_parameter_name.html) SQLite API. +This function resembles the bind_parameter_name SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx index 4d9f2ac..5b5595b 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMClose.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMClose.mdx @@ -11,7 +11,7 @@ bool SQCloudVMClose (SQCloudVM *vm); ### Description Frees the storage associated with a SQCloudVM. The application must finalize every compiled statement in order to avoid resource leaks. -This function resembles the [sqlite3_finalize](https://www.sqlite.org/c3ref/finalize.html) SQLite API. +This function resembles the sqlite3_finalize SQLite API. ### Parameters diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx index 093f460..13d47dc 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumn.mdx @@ -17,7 +17,7 @@ SQCLOUD_VALUE_TYPE SQCloudVMColumnType (SQCloudVM *vm, int index); ### Description These routines return information about a single column of the current result row of a query. -These functions resemble the [sqlite3_column_*](https://www.sqlite.org/c3ref/column_blob.html) SQLite APIs. +These functions resemble the sqlite3_column_* SQLite APIs. ### Parameters diff --git a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx index 1bf7c60..9317ed8 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMColumnCount.mdx @@ -12,7 +12,7 @@ int SQCloudVMColumnCount (SQCloudVM *vm); ### Description The **SQCloudVMColumnCount** returns the number of columns in the result set returned by the prepared statement. If this routine returns 0, that means the prepared statement returns no data (for example an UPDATE). However, just because this routine returns a positive number does not mean that one or more rows of data will be returned. A SELECT statement will always have a positive **SQCloudVMColumnCount** but depending on the WHERE clause constraints and the table content, it might return no rows. -This function resembles the [sqlite3_column_count](https://sqlite.org/c3ref/column_count.html) SQLite APIs. +This function resembles the sqlite3_column_count SQLite APIs. ### Parameters diff --git a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx index 12f1887..2c43e47 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMCompile.mdx @@ -11,7 +11,7 @@ SQCloudVM *SQCloudVMCompile (SQCloudConnection *connection, const char *sql, int ### Description Compile an SQL statement into a byte-code virtual machine. -This function resembles the [sqlite3_prepare](https://www.sqlite.org/c3ref/prepare.html) SQLite API. +This function resembles the sqlite3_prepare SQLite API. ### Parameters * **connection**: A valid connection object obtained by [SQCloudConnect](/docs/sqlite-cloud/sdks/c/sqcloudconnect) or [SQCloudConnectWithString](/docs/sqlite-cloud/sdks/c/sqcloudconnectwithstring) diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx index 208bebb..bafe737 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsExplain.mdx @@ -10,7 +10,7 @@ int SQCloudVMIsExplain (SQCloudVM *vm); ``` ### Description -The **SQCloudVMIsExplain** interface returns 1 if the prepared statement S is an EXPLAIN statement, or 2 if the statement S is an EXPLAIN QUERY PLAN. **SQCloudVMIsExplain** interface returns 0 if the statement is an ordinary statement or a NULL pointer. This function resembles the [sqlite3_stmt_isexplain](https://www.sqlite.org/c3ref/stmt_isexplain.html) SQLite API. +The **SQCloudVMIsExplain** interface returns 1 if the prepared statement S is an EXPLAIN statement, or 2 if the statement S is an EXPLAIN QUERY PLAN. **SQCloudVMIsExplain** interface returns 0 if the statement is an ordinary statement or a NULL pointer. This function resembles the sqlite3_stmt_isexplain SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx index d91c61c..f79741e 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsFinalized.mdx @@ -10,7 +10,7 @@ bool SQCloudVMIsFinalized (SQCloudVM *vm); ``` ### Description -The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sqlite-cloud/sdks/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the [sqlite3_stmt_busy](https://www.sqlite.org/c3ref/stmt_busy.html) SQLite API. +The **SQCloudVMIsFinalized** interface returns true if the prepared statement bound to the vm has been stepped at least once using [SQCloudVMStep](/docs/sqlite-cloud/sdks/c/sqcloudvmstep) but has neither run to completion nor been reset. This function resembles the sqlite3_stmt_busy SQLite API. ### Parameters diff --git a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx index 6d2d7df..08ef626 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMIsReadOnly.mdx @@ -10,7 +10,7 @@ bool SQCloudVMIsReadOnly (SQCloudVM *vm); ``` ### Description -The **SQCloudVMIsReadOnly** interface returns true if and only if the prepared statement bound to vm makes no direct changes to the content of the database file. This routine returns false if there is any possibility that the statement might change the database file. A false return does not guarantee that the statement will change the database file. This function resembles the [sqlite3_stmt_readonly](https://www.sqlite.org/c3ref/stmt_readonly.html) SQLite API. +The **SQCloudVMIsReadOnly** interface returns true if and only if the prepared statement bound to vm makes no direct changes to the content of the database file. This routine returns false if there is any possibility that the statement might change the database file. A false return does not guarantee that the statement will change the database file. This function resembles the sqlite3_stmt_readonly SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx index c7f406b..8271d28 100644 --- a/sqlite-cloud/sdks/c/SQCloudVMStep.mdx +++ b/sqlite-cloud/sdks/c/SQCloudVMStep.mdx @@ -11,7 +11,7 @@ SQCLOUD_RESULT_TYPE SQCloudVMStep (SQCloudVM *vm); ### Description Evaluate an SQL statement previously compiled by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). -This function resembles the [sqlite3_step](https://www.sqlite.org/c3ref/step.html) SQLite API. +This function resembles the sqlite3_step SQLite API. ### Parameters * **vm**: A valid VM obtained by [SQCloudVMCompile](/docs/sqlite-cloud/sdks/c/sqcloudvmcompile). diff --git a/sqlite-cloud/sdks/c/getting-started.mdx b/sqlite-cloud/sdks/c/getting-started.mdx index af48f01..547249f 100644 --- a/sqlite-cloud/sdks/c/getting-started.mdx +++ b/sqlite-cloud/sdks/c/getting-started.mdx @@ -6,7 +6,7 @@ status: publish slug: sdk-c-introduction --- -SQCloud is the C application programmer's interface to SQLite Cloud. SQCloud is a set of library functions that allow client programs to pass queries and SQL commands to the SQLite Cloud backend server and to receive the results of these queries. In addition to the standard SQLite statements, several other [commands](/docs/commands) are supported. +SQCloud is the C application programmer's interface to SQLite Cloud. SQCloud is a set of library functions that allow client programs to pass queries and SQL commands to the SQLite Cloud backend server and to receive the results of these queries. In addition to the standard SQLite statements, several other [commands](server-side-commands) are supported. The following files are required when compiling a C application: * sqcloud.c/.h @@ -15,6 +15,6 @@ The following files are required when compiling a C application: The header file `sqcloud.h` must be included in your C application. -All the communications between the client and the server are encrypted and so, you are required to link the LibreSSL (libtls) library with your client. More information about LibreSSL and how to compile it can be found in the official [LibreSSL](http://www.libressl.org) website. +All the communications between the client and the server are encrypted and so, you are required to link the LibreSSL (libtls) library with your client. More information about LibreSSL and how to compile it can be found in the official LibreSSL website. -The SQCloud APIs implement the [SQLiteCloud Serialization Protocol](https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md). \ No newline at end of file +The SQCloud APIs implement the SQLiteCloud Serialization Protocol. \ No newline at end of file diff --git a/sqlite-cloud/sdks/go/introduction.mdx b/sqlite-cloud/sdks/go/introduction.mdx index c3f719c..c7d49c0 100644 --- a/sqlite-cloud/sdks/go/introduction.mdx +++ b/sqlite-cloud/sdks/go/introduction.mdx @@ -14,7 +14,7 @@ slug: sdk-go-introduction import sqlitecloud "github.com/sqlitecloud/sqlitecloud-go" ``` -2. Download the package, and run the [`go mod tidy` command](https://go.dev/ref/mod#go-mod-tidy) to synchronize your module's dependencies: +2. Download the package, and run the `go mod tidy` command to synchronize your module's dependencies: ```bash $ go mod tidy @@ -76,20 +76,37 @@ sqlitecloud://user:pass@host.com:port/dbname?timeout=10&key2=value2&key3=value3 To get a valid connection string, follow these instructions: -- Get a [SQLite Cloud](https://dashboard.sqlitecloud.io/auth/sign-in) account. See the documentation for details. +- Get a SQLite Cloud account. See the documentation for details. - Create a SQLite Cloud project - Create a SQLite Cloud database -- Get the connection string by clicking on the node address in the [Dashboard Nodes](https://docs.sqlitecloud.io/docs/introduction/nodes) section. A valid connection string will be copied to your clipboard. +- Get the connection string by clicking on the node address in the Dashboard Nodes section. A valid connection string will be copied to your clipboard. - Add the database name to your connection string. ## API Documentation -The complete documentation is available at: [https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go](https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go) +The complete documentation is available +here. -[![Test and QA](https://github.com/sqlitecloud/sqlitecloud-go/actions/workflows/testing.yaml/badge.svg?branch=main)](https://github.com/sqlitecloud/sqlitecloud-go/actions/workflows/testing.yaml) -[![codecov](https://codecov.io/gh/sqlitecloud/sqlitecloud-go/graph/badge.svg?token=5MAG3G4X01)](https://codecov.io/gh/sqlitecloud/sqlitecloud-go) -[![GitHub Tag](https://img.shields.io/github/v/tag/sqlitecloud/sqlitecloud-go?label=version&link=https%3A%2F%2Fpkg.go.dev%2Fgithub.com%2Fsqlitecloud%2Fsqlitecloud-go)](https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go) -[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/sqlitecloud/sqlitecloud-go?link=https%3A%2F%2Fpkg.go.dev%2Fgithub.com%2Fsqlitecloud%2Fsqlitecloud-go)](https://pkg.go.dev/github.com/sqlitecloud/sqlitecloud-go) + + Test and QA + -[SQLite Cloud](https://sqlite.ai) for Go is a powerful package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Go applications, making it easier than ever to work with SQLite Cloud. In addition to the standard SQLite statements, several other [commands](https://docs.sqlitecloud.io/docs/commands) are supported. +
    + + codecov + + +
    + + + GitHub Tag + + +
    + + + GitHub go.mod Go version + + +SQLite Cloud for Go is a powerful package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in Go applications, making it easier than ever to work with SQLite Cloud. In addition to the standard SQLite statements, several other [commands](server-side-commands) are supported. \ No newline at end of file diff --git a/sqlite-cloud/sdks/js/classes/Database.md b/sqlite-cloud/sdks/js/classes/Database.md index 8d943a0..c625d9a 100644 --- a/sqlite-cloud/sdks/js/classes/Database.md +++ b/sqlite-cloud/sdks/js/classes/Database.md @@ -84,7 +84,7 @@ EventEmitter.constructor #### Defined in -[src/drivers/database.ts:33](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L33) +src/drivers/database.ts:33 • **new Database**(`config`, `mode?`, `callback?`): [`Database`](database) @@ -106,7 +106,7 @@ EventEmitter.constructor #### Defined in -[src/drivers/database.ts:34](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L34) +src/drivers/database.ts:34 ## Properties @@ -118,7 +118,7 @@ Configuration used to open database connections #### Defined in -[src/drivers/database.ts:57](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L57) +src/drivers/database.ts:57 ___ @@ -130,7 +130,7 @@ Database connections #### Defined in -[src/drivers/database.ts:60](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L60) +src/drivers/database.ts:60 ___ @@ -215,7 +215,7 @@ calls to retrieve a previously unknown amount of rows. #### Defined in -[src/drivers/database.ts:273](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L273) +src/drivers/database.ts:273 ▸ **all**\<`T`\>(`sql`, `params`, `callback?`): [`Database`](database) @@ -239,7 +239,7 @@ calls to retrieve a previously unknown amount of rows. #### Defined in -[src/drivers/database.ts:274](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L274) +src/drivers/database.ts:274 ___ @@ -266,7 +266,7 @@ parameters is emitted, regardless of whether a callback was provided or not. #### Defined in -[src/drivers/database.ts:394](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L394) +src/drivers/database.ts:394 ___ @@ -289,7 +289,7 @@ Set a configuration option for the database #### Defined in -[src/drivers/database.ts:190](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L190) +src/drivers/database.ts:190 ___ @@ -330,7 +330,7 @@ way to abort execution. #### Defined in -[src/drivers/database.ts:312](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L312) +src/drivers/database.ts:312 ▸ **each**\<`T`\>(`sql`, `params`, `callback?`, `complete?`): [`Database`](database) @@ -355,7 +355,7 @@ way to abort execution. #### Defined in -[src/drivers/database.ts:313](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L313) +src/drivers/database.ts:313 ___ @@ -411,7 +411,7 @@ Emits given event with optional arguments on the next tick so callbacks can comp #### Defined in -[src/drivers/database.ts:160](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L160) +src/drivers/database.ts:160 ___ @@ -462,7 +462,7 @@ will be emitted on the database object. #### Defined in -[src/drivers/database.ts:368](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L368) +src/drivers/database.ts:368 ___ @@ -498,7 +498,7 @@ the only supported way is by column name. #### Defined in -[src/drivers/database.ts:235](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L235) +src/drivers/database.ts:235 ▸ **get**\<`T`\>(`sql`, `params`, `callback?`): [`Database`](database) @@ -522,7 +522,7 @@ the only supported way is by column name. #### Defined in -[src/drivers/database.ts:236](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L236) +src/drivers/database.ts:236 ___ @@ -542,7 +542,7 @@ A configuration object #### Defined in -[src/drivers/database.ts:176](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L176) +src/drivers/database.ts:176 ___ @@ -564,7 +564,7 @@ Returns first available connection from connection pool #### Defined in -[src/drivers/database.ts:67](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L67) +src/drivers/database.ts:67 ___ @@ -588,7 +588,7 @@ Handles an error by closing the connection, calling the callback and/or emitting #### Defined in -[src/drivers/database.ts:117](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L117) +src/drivers/database.ts:117 ___ @@ -607,7 +607,7 @@ open to use this function. #### Defined in -[src/drivers/database.ts:429](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L429) +src/drivers/database.ts:429 ___ @@ -688,7 +688,7 @@ Loads a compiled SQLite extension into the database connection object. #### Defined in -[src/drivers/database.ts:413](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L413) +src/drivers/database.ts:413 ___ @@ -822,7 +822,7 @@ they are bound to the prepared statement before calling the callback. #### Defined in -[src/drivers/database.ts:353](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L353) +src/drivers/database.ts:353 ___ @@ -854,7 +854,7 @@ https://github.com/TryGhost/node-sqlite3/wiki/API#runsql--param---callback #### Defined in -[src/drivers/database.ts:141](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L141) +src/drivers/database.ts:141 ___ @@ -948,7 +948,7 @@ which it was called to allow for function chaining. #### Defined in -[src/drivers/database.ts:202](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L202) +src/drivers/database.ts:202 ▸ **run**\<`T`\>(`sql`, `params`, `callback?`): [`Database`](database) @@ -972,7 +972,7 @@ which it was called to allow for function chaining. #### Defined in -[src/drivers/database.ts:203](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L203) +src/drivers/database.ts:203 ___ @@ -1001,7 +1001,7 @@ metadata in case of insert, update, delete. #### Defined in -[src/drivers/database.ts:447](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L447) +src/drivers/database.ts:447 ___ @@ -1017,4 +1017,4 @@ Enable verbose mode #### Defined in -[src/drivers/database.ts:181](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/database.ts#L181) +src/drivers/database.ts:181 diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md index 545bc6c..d428d66 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudConnection.md @@ -55,7 +55,7 @@ Parse and validate provided connectionString or configuration #### Defined in -[src/drivers/connection.ts:16](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L16) +src/drivers/connection.ts:16 ## Properties @@ -67,7 +67,7 @@ Configuration passed by client or extracted from connection string #### Defined in -[src/drivers/connection.ts:28](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L28) +src/drivers/connection.ts:28 ___ @@ -79,7 +79,7 @@ Operations are serialized by waiting an any pending promises #### Defined in -[src/drivers/connection.ts:31](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L31) +src/drivers/connection.ts:31 ## Accessors @@ -95,7 +95,7 @@ Returns true if connection is open #### Defined in -[src/drivers/connection.ts:74](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L74) +src/drivers/connection.ts:74 ## Methods @@ -111,7 +111,7 @@ Disconnect from server, release transport. #### Defined in -[src/drivers/connection.ts:100](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L100) +src/drivers/connection.ts:100 ___ @@ -133,7 +133,7 @@ Connect will establish a tls or websocket transport to the server based on confi #### Defined in -[src/drivers/connection.ts:38](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L38) +src/drivers/connection.ts:38 ___ @@ -154,7 +154,7 @@ ___ #### Defined in -[src/drivers/connection.ts:56](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L56) +src/drivers/connection.ts:56 ___ @@ -177,7 +177,7 @@ Will log to console if verbose mode is enabled #### Defined in -[src/drivers/connection.ts:62](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L62) +src/drivers/connection.ts:62 ___ @@ -200,7 +200,7 @@ Will enquee a command to be executed and callback with the resulting rowset/resu #### Defined in -[src/drivers/connection.ts:82](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L82) +src/drivers/connection.ts:82 ___ @@ -223,7 +223,7 @@ Send a command, return the rowset/result or throw an error #### Defined in -[src/drivers/connection.ts:59](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L59) +src/drivers/connection.ts:59 ___ @@ -239,4 +239,4 @@ Enable verbose logging for debug purposes #### Defined in -[src/drivers/connection.ts:77](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/connection.ts#L77) +src/drivers/connection.ts:77 diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md index 33969cc..eea1af3 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudError.md @@ -59,7 +59,7 @@ Error.constructor #### Defined in -[src/drivers/types.ts:102](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L102) +src/drivers/types.ts:102 ## Properties @@ -75,7 +75,7 @@ Error.cause #### Defined in -[src/drivers/types.ts:111](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L111) +src/drivers/types.ts:111 ___ @@ -87,7 +87,7 @@ Error code returned by drivers or server #### Defined in -[src/drivers/types.ts:113](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L113) +src/drivers/types.ts:113 ___ @@ -99,7 +99,7 @@ Additional error code #### Defined in -[src/drivers/types.ts:115](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L115) +src/drivers/types.ts:115 ___ @@ -139,7 +139,7 @@ Additional offset code in commands #### Defined in -[src/drivers/types.ts:117](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L117) +src/drivers/types.ts:117 ___ diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md index c39b217..d0eea36 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudRow.md @@ -50,7 +50,7 @@ Column values are accessed by column name #### Defined in -[src/drivers/rowset.ts:9](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L9) +src/drivers/rowset.ts:9 ## Properties @@ -60,7 +60,7 @@ Column values are accessed by column name #### Defined in -[src/drivers/rowset.ts:21](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L21) +src/drivers/rowset.ts:21 ___ @@ -70,7 +70,7 @@ ___ #### Defined in -[src/drivers/rowset.ts:18](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L18) +src/drivers/rowset.ts:18 ## Methods @@ -86,7 +86,7 @@ Returns rowset data as a plain array of values #### Defined in -[src/drivers/rowset.ts:31](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L31) +src/drivers/rowset.ts:31 ___ @@ -102,4 +102,4 @@ Returns the rowset that this row belongs to #### Defined in -[src/drivers/rowset.ts:25](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L25) +src/drivers/rowset.ts:25 diff --git a/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md b/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md index 7cd5824..472551d 100644 --- a/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md +++ b/sqlite-cloud/sdks/js/classes/SQLiteCloudRowset.md @@ -98,7 +98,7 @@ Array\<SQLiteCloudRow\>.constructor #### Defined in -[src/drivers/rowset.ts:41](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L41) +src/drivers/rowset.ts:41 ## Properties @@ -110,7 +110,7 @@ Actual data organized in rows #### Defined in -[src/drivers/rowset.ts:72](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L72) +src/drivers/rowset.ts:72 ___ @@ -122,7 +122,7 @@ Metadata contains number of rows and columns, column names, types, etc. #### Defined in -[src/drivers/rowset.ts:69](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L69) +src/drivers/rowset.ts:69 ___ @@ -168,7 +168,7 @@ Array of columns names #### Defined in -[src/drivers/rowset.ts:93](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L93) +src/drivers/rowset.ts:93 ___ @@ -184,7 +184,7 @@ Get rowset metadata #### Defined in -[src/drivers/rowset.ts:98](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L98) +src/drivers/rowset.ts:98 ___ @@ -200,7 +200,7 @@ Number of columns in row set #### Defined in -[src/drivers/rowset.ts:88](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L88) +src/drivers/rowset.ts:88 ___ @@ -216,7 +216,7 @@ Number of rows in row set #### Defined in -[src/drivers/rowset.ts:83](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L83) +src/drivers/rowset.ts:83 ___ @@ -236,7 +236,7 @@ https://github.com/sqlitecloud/sdk/blob/master/PROTOCOL.md #### Defined in -[src/drivers/rowset.ts:78](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L78) +src/drivers/rowset.ts:78 ## Methods @@ -522,7 +522,7 @@ Array.filter #### Defined in -[src/drivers/rowset.ts:141](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L141) +src/drivers/rowset.ts:141 ___ @@ -726,7 +726,7 @@ Return value of item at given row and column #### Defined in -[src/drivers/rowset.ts:103](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L103) +src/drivers/rowset.ts:103 ___ @@ -877,7 +877,7 @@ Array.map #### Defined in -[src/drivers/rowset.ts:131](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L131) +src/drivers/rowset.ts:131 ___ @@ -1145,7 +1145,7 @@ Array.slice #### Defined in -[src/drivers/rowset.ts:113](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/rowset.ts#L113) +src/drivers/rowset.ts:113 ___ diff --git a/sqlite-cloud/sdks/js/classes/Statement.md b/sqlite-cloud/sdks/js/classes/Statement.md index c068a3c..efbb082 100644 --- a/sqlite-cloud/sdks/js/classes/Statement.md +++ b/sqlite-cloud/sdks/js/classes/Statement.md @@ -60,7 +60,7 @@ A statement generated by Database.prepare used to prepare SQL with ? bindings #### Defined in -[src/drivers/statement.ts:13](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L13) +src/drivers/statement.ts:13 ## Properties @@ -72,7 +72,7 @@ Statement belongs to this database #### Defined in -[src/drivers/statement.ts:25](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L25) +src/drivers/statement.ts:25 ___ @@ -84,7 +84,7 @@ The SQL statement with binding values applied #### Defined in -[src/drivers/statement.ts:31](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L31) +src/drivers/statement.ts:31 ___ @@ -96,7 +96,7 @@ The SQL statement with ? binding placeholders #### Defined in -[src/drivers/statement.ts:28](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L28) +src/drivers/statement.ts:28 ## Methods @@ -120,7 +120,7 @@ for function chaining. The parameters are the same as the Statement#run function #### Defined in -[src/drivers/statement.ts:121](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L121) +src/drivers/statement.ts:121 ▸ **all**(`params`, `callback?`): [`Statement`](statement)\<`T`\> @@ -137,7 +137,7 @@ for function chaining. The parameters are the same as the Statement#run function #### Defined in -[src/drivers/statement.ts:122](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L122) +src/drivers/statement.ts:122 ___ @@ -165,7 +165,7 @@ are escaped client side and turned into literals before being executed on the se #### Defined in -[src/drivers/statement.ts:42](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L42) +src/drivers/statement.ts:42 ___ @@ -190,7 +190,7 @@ are the same as the Database#each function. #### Defined in -[src/drivers/statement.ts:147](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L147) +src/drivers/statement.ts:147 ▸ **each**(`params`, `callback?`, `complete?`): [`Statement`](statement)\<`T`\> @@ -208,7 +208,7 @@ are the same as the Database#each function. #### Defined in -[src/drivers/statement.ts:148](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L148) +src/drivers/statement.ts:148 ___ @@ -235,7 +235,7 @@ the second parameter is undefined, otherwise it is an object containing the valu #### Defined in -[src/drivers/statement.ts:95](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L95) +src/drivers/statement.ts:95 ▸ **get**(`params`, `callback?`): [`Statement`](statement)\<`T`\> @@ -252,7 +252,7 @@ the second parameter is undefined, otherwise it is an object containing the valu #### Defined in -[src/drivers/statement.ts:96](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L96) +src/drivers/statement.ts:96 ___ @@ -279,7 +279,7 @@ can run it multiple times. #### Defined in -[src/drivers/statement.ts:66](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L66) +src/drivers/statement.ts:66 ▸ **run**(`params`, `callback?`): [`Statement`](statement)\<`T`\> @@ -296,4 +296,4 @@ can run it multiple times. #### Defined in -[src/drivers/statement.ts:67](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/statement.ts#L67) +src/drivers/statement.ts:67 diff --git a/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md b/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md index 99788a0..91bcd89 100644 --- a/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md +++ b/sqlite-cloud/sdks/js/interfaces/SQLCloudRowsetMetadata.md @@ -27,7 +27,7 @@ Columns' metadata #### Defined in -[src/drivers/types.ts:77](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L77) +src/drivers/types.ts:77 ___ @@ -39,7 +39,7 @@ Number of columns #### Defined in -[src/drivers/types.ts:74](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L74) +src/drivers/types.ts:74 ___ @@ -51,7 +51,7 @@ Number of rows #### Defined in -[src/drivers/types.ts:72](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L72) +src/drivers/types.ts:72 ___ @@ -63,4 +63,4 @@ Rowset version 1 has column's name, version 2 has extended metadata #### Defined in -[src/drivers/types.ts:70](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L70) +src/drivers/types.ts:70 diff --git a/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md b/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md index 5b2906e..e96a76e 100644 --- a/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md +++ b/sqlite-cloud/sdks/js/interfaces/SQLiteCloudConfig.md @@ -45,7 +45,7 @@ Optional identifier used for verbose logging #### Defined in -[src/drivers/types.ts:62](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L62) +src/drivers/types.ts:62 ___ @@ -55,7 +55,7 @@ ___ #### Defined in -[src/drivers/types.ts:41](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L41) +src/drivers/types.ts:41 ___ @@ -67,7 +67,7 @@ Connection string in the form of sqlitecloud://user:password@host:port/database? #### Defined in -[src/drivers/types.ts:15](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L15) +src/drivers/types.ts:15 ___ @@ -79,7 +79,7 @@ Create the database if it doesn't exist? #### Defined in -[src/drivers/types.ts:37](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L37) +src/drivers/types.ts:37 ___ @@ -91,7 +91,7 @@ Name of database to open #### Defined in -[src/drivers/types.ts:34](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L34) +src/drivers/types.ts:34 ___ @@ -103,7 +103,7 @@ Database will be created in memory #### Defined in -[src/drivers/types.ts:39](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L39) +src/drivers/types.ts:39 ___ @@ -115,7 +115,7 @@ Url where we can connect to a SQLite Cloud Gateway that has a socket.io deamon w #### Defined in -[src/drivers/types.ts:59](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L59) +src/drivers/types.ts:59 ___ @@ -127,7 +127,7 @@ Host name is required unless connectionString is provided, eg: xxx.sqlitecloud.i #### Defined in -[src/drivers/types.ts:25](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L25) +src/drivers/types.ts:25 ___ @@ -139,7 +139,7 @@ Connect using plain TCP port, without TLS encryption, NOT RECOMMENDED, TEST ONLY #### Defined in -[src/drivers/types.ts:29](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L29) +src/drivers/types.ts:29 ___ @@ -151,7 +151,7 @@ Do not send columns with more than max_data bytes #### Defined in -[src/drivers/types.ts:47](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L47) +src/drivers/types.ts:47 ___ @@ -163,7 +163,7 @@ Server should chunk responses with more than maxRows #### Defined in -[src/drivers/types.ts:49](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L49) +src/drivers/types.ts:49 ___ @@ -175,7 +175,7 @@ Server should limit total number of rows in a set to maxRowset #### Defined in -[src/drivers/types.ts:51](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L51) +src/drivers/types.ts:51 ___ @@ -187,7 +187,7 @@ Server should send BLOB columns #### Defined in -[src/drivers/types.ts:45](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L45) +src/drivers/types.ts:45 ___ @@ -199,7 +199,7 @@ Request for immediate responses from the server node without waiting for lineriz #### Defined in -[src/drivers/types.ts:43](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L43) +src/drivers/types.ts:43 ___ @@ -211,7 +211,7 @@ Password is required unless connection string is provided #### Defined in -[src/drivers/types.ts:20](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L20) +src/drivers/types.ts:20 ___ @@ -223,7 +223,7 @@ True if password is hashed, default is false #### Defined in -[src/drivers/types.ts:22](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L22) +src/drivers/types.ts:22 ___ @@ -235,7 +235,7 @@ Port number for tls socket #### Defined in -[src/drivers/types.ts:27](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L27) +src/drivers/types.ts:27 ___ @@ -247,7 +247,7 @@ Optional query timeout passed directly to TLS socket #### Defined in -[src/drivers/types.ts:32](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L32) +src/drivers/types.ts:32 ___ @@ -259,7 +259,7 @@ Custom options and configurations for tls socket, eg: additional certificates #### Defined in -[src/drivers/types.ts:54](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L54) +src/drivers/types.ts:54 ___ @@ -271,7 +271,7 @@ True if we should force use of SQLite Cloud Gateway and websocket connections, d #### Defined in -[src/drivers/types.ts:57](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L57) +src/drivers/types.ts:57 ___ @@ -283,7 +283,7 @@ User name is required unless connectionString is provided #### Defined in -[src/drivers/types.ts:18](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L18) +src/drivers/types.ts:18 ___ @@ -295,4 +295,4 @@ True if connection should enable debug logs #### Defined in -[src/drivers/types.ts:64](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L64) +src/drivers/types.ts:64 diff --git a/sqlite-cloud/sdks/js/introduction.mdx b/sqlite-cloud/sdks/js/introduction.mdx index a763b04..b0af687 100644 --- a/sqlite-cloud/sdks/js/introduction.mdx +++ b/sqlite-cloud/sdks/js/introduction.mdx @@ -7,11 +7,25 @@ status: publish slug: sdk-js-introduction --- -[![npm package][npm-img]][npm-url] -[![Build Status][build-img]][build-url] -[![Downloads][downloads-img]][downloads-url] -[![Issues][issues-img]][issues-url] -[![codecov](https://codecov.io/gh/sqlitecloud/sqlitecloud-js/graph/badge.svg?token=ZOKE9WFH62)](https://codecov.io/gh/sqlitecloud/sqlitecloud-js) + + npm package + +
    + + Build Status + +
    + + Downloads + +
    + + Issues + +
    + + codecov + ## Install @@ -34,26 +48,14 @@ let results = await database.sql`SELECT * FROM tracks WHERE name = ${name}` Use [Database.sql](/docs/sqlite-cloud/sdks/js/classes/database#sql) to execute prepared statements or plain SQL queries asynchronously. This method returns an array of rows for SELECT queries and supports the standard syntax for UPDATE, INSERT, and DELETE. -We aim for full compatibility with the established [sqlite3 API](https://www.npmjs.com/package/sqlite3), with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlite.ai) while continuing to use your existing codebase. +We aim for full compatibility with the established sqlite3 API, with the primary distinction being that our driver connects to SQLiteCloud databases. This allows you to migrate your SQLite to the cloud while continuing to use your existing codebase. The package is developed entirely in TypeScript and is fully compatible with JavaScript. It doesn't require any native libraries. This makes it a straightforward and effective tool for managing cloud-based databases in a familiar SQLite environment. ## More -How do I deploy SQLite in the cloud? -[https://sqlite.ai](https://sqlite.ai) - -How do I connect SQLite cloud with Javascript? -[https://sqlitecloud.github.io/sqlitecloud-js/](https://sqlitecloud.github.io/sqlitecloud-js/) - -How can I contribute or suggest features? -[https://github.com/sqlitecloud/sqlitecloud-js/issues](https://github.com/sqlitecloud/sqlitecloud-js/issues) - -[build-img]: https://github.com/sqlitecloud/sqlitecloud-js/actions/workflows/build-test-deploy.yml/badge.svg -[build-url]: https://github.com/sqlitecloud/sqlitecloud-js/actions/workflows/build-test-deploy.yml -[downloads-img]: https://img.shields.io/npm/dt/@sqlitecloud/drivers -[downloads-url]: https://www.npmtrends.com/@sqlitecloud/drivers -[npm-img]: https://img.shields.io/npm/v/@sqlitecloud/drivers -[npm-url]: https://www.npmjs.com/package/@sqlitecloud/drivers -[issues-img]: https://img.shields.io/github/issues/sqlitecloud/sqlitecloud-js -[issues-url]: https://github.com/sqlitecloud/sqlitecloud-js/issues +How do I deploy SQLite in the cloud? +
    +How do I connect SQLite cloud with Javascript? +
    +How can I contribute or suggest features? diff --git a/sqlite-cloud/sdks/js/modules.md b/sqlite-cloud/sdks/js/modules.md index 07e006e..4b9c81d 100644 --- a/sqlite-cloud/sdks/js/modules.md +++ b/sqlite-cloud/sdks/js/modules.md @@ -56,7 +56,7 @@ slug: sdk-js-modules #### Defined in -[src/drivers/types.ts:120](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/types.ts#L120) +src/drivers/types.ts:120 ## Functions @@ -78,7 +78,7 @@ Takes a generic value and escapes it so it can replace ? as a binding in a prepa #### Defined in -[src/drivers/utilities.ts:70](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/utilities.ts#L70) +src/drivers/utilities.ts:70 ___ @@ -100,7 +100,7 @@ Parse connectionString like sqlitecloud://username:password@host:port/database?o #### Defined in -[src/drivers/utilities.ts:210](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/utilities.ts#L210) +src/drivers/utilities.ts:210 ___ @@ -123,7 +123,7 @@ Take a sql statement and replaces ? or $named parameters that are properly seria #### Defined in -[src/drivers/utilities.ts:105](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/utilities.ts#L105) +src/drivers/utilities.ts:105 ___ @@ -145,4 +145,4 @@ Validate configuration, apply defaults, throw if something is missing or misconf #### Defined in -[src/drivers/utilities.ts:173](https://github.com/sqlitecloud/sqlitecloud-js/blob/f7cd658/src/drivers/utilities.ts#L173) +src/drivers/utilities.ts:173 diff --git a/sqlite-cloud/sdks/php/introduction.mdx b/sqlite-cloud/sdks/php/introduction.mdx index e2591cf..2d9603a 100644 --- a/sqlite-cloud/sdks/php/introduction.mdx +++ b/sqlite-cloud/sdks/php/introduction.mdx @@ -6,7 +6,7 @@ status: publish slug: sdk-php-introduction --- -This powerful package provides methods that simplify performing database operations in PHP applications, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK’s issues backlog](https://github.com/sqlitecloud/sqlitecloud-php/issues). +This powerful package provides methods that simplify performing database operations in PHP applications, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the SDK’s issues backlog. ## Install diff --git a/sqlite-cloud/sdks/python/introduction.mdx b/sqlite-cloud/sdks/python/introduction.mdx index 7e8cb9b..885af17 100644 --- a/sqlite-cloud/sdks/python/introduction.mdx +++ b/sqlite-cloud/sdks/python/introduction.mdx @@ -15,7 +15,7 @@ pip install sqlitecloud ## Basic Usage -We aim for full compatibility with the established [sqlite3 API](https://docs.python.org/3/library/sqlite3.html), with the primary distinction being that our driver connects to SQLite Cloud databases. This allows you to migrate your [SQLite to the cloud](https://sqlite.ai) while continuing to use your existing codebase. +We aim for full compatibility with the established sqlite3 API, with the primary distinction being that our driver connects to SQLite Cloud databases. This allows you to migrate your SQLite to the cloud while continuing to use your existing codebase. ```python import sqlitecloud diff --git a/sqlite-cloud/sdks/swift/introduction.mdx b/sqlite-cloud/sdks/swift/introduction.mdx index 58c3679..6d7b0b7 100644 --- a/sqlite-cloud/sdks/swift/introduction.mdx +++ b/sqlite-cloud/sdks/swift/introduction.mdx @@ -6,7 +6,7 @@ status: publish slug: sdk-swift-introduction --- -This powerful package provides methods that perform DB operations, and enables real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the [SDK's issues backlog](https://github.com/sqlitecloud/sqlitecloud-swift/issues). +This powerful package provides methods that perform DB operations, and enables real-time notifications in Swift apps, making it easier than ever to work with SQLite in the cloud. We encourage all users to log encountered issues in the SDK's issues backlog. ## Install diff --git a/sqlite-cloud/sqlite-ai/mcp-server.mdx b/sqlite-cloud/sqlite-ai/mcp-server.mdx index e36c5f1..089c429 100644 --- a/sqlite-cloud/sqlite-ai/mcp-server.mdx +++ b/sqlite-cloud/sqlite-ai/mcp-server.mdx @@ -6,7 +6,7 @@ status: publish slug: mcp-server --- -The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is a standard for connecting various data sources (like your SQLite Cloud database) to Large Language Models (LLMs). The MCP Server for SQLite Cloud provides tools for executing queries, managing schemas, and analyzing query performance. +The Model Context Protocol (MCP) is a standard for connecting various data sources (like your SQLite Cloud database) to Large Language Models (LLMs). The MCP Server for SQLite Cloud provides tools for executing queries, managing schemas, and analyzing query performance. ## Features @@ -15,15 +15,15 @@ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) - **Command Execution**: Run predefined commands supported by SQLite Cloud. - **Performance Analysis**: Identify slow queries, analyze query plans, and reset query statistics. -[Explore the available tools here](https://github.com/sqlitecloud/sqlitecloud-mcp-server). +Explore the available tools here. ## Getting Started -To use the MCP Server, create a [free account on SQLite Cloud](https://dashboard.sqlitecloud.io/auth/sign-in) and obtain your **Connection String**. +To use the MCP Server, create a free account on SQLite Cloud and obtain your **Connection String**. ### Requirements -You need [Node.js](https://nodejs.org) installed on your computer to run the MCP Server. To check if Node.js is installed, open a terminal: +You need Node.js installed on your computer to run the MCP Server. To check if Node.js is installed, open a terminal: - **Linux**: Open the terminal from the Applications menu. - **macOS**: Open the Terminal app from the Applications folder or use Spotlight Search (`Cmd+Space`) and type "Terminal." @@ -35,12 +35,12 @@ Then type the following command and press Enter: node --version ``` -If the command returns a version number, Node.js is installed. If you see an error like "command not found" or "node is not recognized," download and install Node.js from [nodejs.org](https://nodejs.org). +If the command returns a version number, Node.js is installed. If you see an error like "command not found" or "node is not recognized," download and install Node.js from nodejs.org. ## Configure the AI Agent This guide explains how to connect the MCP Server for SQLite Cloud to common AI agents that support MCP. -[Find a list of supported tools and IDEs here](https://modelcontextprotocol.io/clients). +Find a list of supported tools and IDEs here. After configuring your AI agent, try asking it questions about your SQLite Cloud database, such as: @@ -51,7 +51,7 @@ Explore or manipulate your database using natural language queries. ### Claude Desktop -Refer to the [official documentation](https://modelcontextprotocol.io/quickstart/user) for detailed instructions. +Refer to the official documentation for detailed instructions. 1. Open Claude Desktop and navigate to **Settings**. 2. Go to the **Developer** section and click on **Edit Config** to open the configuration file. @@ -81,7 +81,7 @@ Refer to the [official documentation](https://modelcontextprotocol.io/quickstart ### Cursor -Refer to the [official documentation](https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers) for detailed instructions. +Refer to the official documentation for detailed instructions. 1. In the root of your project, create the file `.cursor/mcp.json`. 2. Add the following configuration: @@ -111,7 +111,7 @@ Refer to the [official documentation](https://docs.cursor.com/context/model-cont ### VSCode Copilot -Refer to the [official documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for detailed instructions. +Refer to the official documentation for detailed instructions. 1. In the root of your project, create the file `.vscode/mcp.json`. 2. Add the following configuration: diff --git a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx index 6e47c04..e2857ae 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-ai.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-ai.mdx @@ -6,8 +6,8 @@ status: publish slug: sqlite-ai --- -[SQLite-AI](https://sqlite.ai/sqlite-ai) is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. +SQLite-AI is a groundbreaking extension that brings powerful AI capabilities directly into SQLite. By embedding llama and whisper, it enables local LLM inference, text generation, embedding creation, speech recognition, translation, and even multimodal support, all from within the database itself. With a simple SQL interface, you can chat with a model, stream tokens in real time, generate high-quality embeddings, or transcribe and translate audio using Whisper. Multimodal features allow image processing and embedding, making SQLite-AI a versatile foundation for modern AI applications. -**SQLite-AI** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-ai). +**SQLite-AI** is an open-source project available on GitHub. diff --git a/sqlite-cloud/sqlite-ai/sqlite-js.mdx b/sqlite-cloud/sqlite-ai/sqlite-js.mdx index 0456e2c..9109a86 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-js.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-js.mdx @@ -6,8 +6,8 @@ status: publish slug: sqlite-js --- -[SQLite-JS](https://website-stage.sqlitecloud.io/sqlite-js) is a powerful extension that lets you write custom cross-platform logic directly in your SQLite database using JavaScript. With support for scalar, aggregate, window functions, and collation sequences, you can express complex operations with ease, all using familiar SQL syntax. +SQLite-JS is a powerful extension that lets you write custom cross-platform logic directly in your SQLite database using JavaScript. With support for scalar, aggregate, window functions, and collation sequences, you can express complex operations with ease, all using familiar SQL syntax. -By integrating SQLite-JS with [SQLite-Sync](sqlite-sync), your user-defined JavaScript functions are automatically synchronized across all clients connected to your cluster, keeping logic consistent everywhere, even offline, for a truly consistent offline-first server-side logic distribution. +By integrating SQLite-JS with [SQLite-Sync](sqlite-sync-introduction), your user-defined JavaScript functions are automatically synchronized across all clients connected to your cluster, keeping logic consistent everywhere, even offline, for a truly consistent offline-first server-side logic distribution. -**SQLite-JS** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-js). \ No newline at end of file +**SQLite-JS** is an open-source project available on GitHub. \ No newline at end of file diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md index 9850493..35d7697 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/getting-started.md @@ -10,12 +10,12 @@ Here's a quick example to get started with SQLite Sync: ### Prerequisites -1. **SQLite Cloud Account**: Sign up at [SQLite Cloud](https://sqlitecloud.io/) -2. **SQLite Sync Extension**: Download from [Releases](https://github.com/sqliteai/sqlite-sync/releases) +1. **SQLite Cloud Account**: Sign up at SQLite Cloud +2. **SQLite Sync Extension**: Download from Releases ### SQLite Cloud Setup -1. Create a new project and database in your [SQLite Cloud Dashboard](https://dashboard.sqlitecloud.io/) +1. Create a new project and database in your SQLite Cloud Dashboard 2. Copy your connection string and API key from the dashboard 3. Create tables with identical schema in both local and cloud databases 4. [Enable synchronization](/docs/offsync#:~:text=in%20the%20cloud.-,Configuring%20OffSync,-You%20can%20enable): go to Databases > Offsync page and select each table you want to synchronize in your database @@ -118,7 +118,7 @@ SELECT cloudsync_terminate(); ### For a Complete Example -See the [examples](https://github.com/sqliteai/sqlite-sync/blob/main/examples/simple-todo-db/README.md) directory for a comprehensive walkthrough including: +See the examples directory for a comprehensive walkthrough including: - Multi-device collaboration - Offline scenarios diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md index cc4a012..7d5bd64 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/introduction.md @@ -6,7 +6,7 @@ status: publish slug: sqlite-sync-introduction --- -[SQLite Sync](https://github.com/sqliteai/sqlite-sync) is a multi-platform extension that brings a true **local-first experience** to your applications with minimal effort. It extends standard SQLite tables with built-in support for offline work and automatic synchronization, allowing multiple devices to operate independently—even without a network connection—and seamlessly stay in sync. With SQLite Sync, developers can easily build **distributed, collaborative applications** while continuing to rely on the **simplicity, reliability, and performance of SQLite**. +SQLite Sync is a multi-platform extension that brings a true **local-first experience** to your applications with minimal effort. It extends standard SQLite tables with built-in support for offline work and automatic synchronization, allowing multiple devices to operate independently—even without a network connection—and seamlessly stay in sync. With SQLite Sync, developers can easily build **distributed, collaborative applications** while continuing to rely on the **simplicity, reliability, and performance of SQLite**. Under the hood, SQLite Sync uses advanced **CRDT (Conflict-free Replicated Data Type)** algorithms and data structures designed specifically for **collaborative, distributed systems**. This means: @@ -34,7 +34,7 @@ Unlike traditional sync systems that require you to build and maintain a complex - Compatible with **any language or framework** that supports SQLite. - **No backend setup required** — SQLite Sync handles networking, change tracking, and conflict resolution for you. -The sync layer is tightly integrated with [**SQLite Cloud**](https://sqlitecloud.io/), enabling seamless and secure data sharing across devices, users, and platforms. You get the power of cloud sync without the complexity. +The sync layer is tightly integrated with **SQLite Cloud**, enabling seamless and secure data sharing across devices, users, and platforms. You get the power of cloud sync without the complexity. ## Row-Level Security @@ -92,6 +92,6 @@ SQLite Sync is ideal for building collaborative and distributed apps across web, Use SQLite-Sync alongside: -- **[SQLite-AI](https://github.com/sqliteai/sqlite-ai)** – on-device inference, embedding generation, and model interaction directly into your database -- **[SQLite-Vector](https://github.com/sqliteai/sqlite-vector)** – vector search from SQL -- **[SQLite-JS](https://github.com/sqliteai/sqlite-js)** – define SQLite functions in JavaScript +- **SQLite-AI** – on-device inference, embedding generation, and model interaction directly into your database +- **SQLite-Vector** – vector search from SQL +- **SQLite-JS** – define SQLite functions in JavaScript diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx index 771f010..6aef820 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/android.mdx @@ -12,7 +12,7 @@ This guide shows how to integrate sqlite-sync extension into your Android applic ### 1. Add Dependencies -You can [add sqlite-sync as a dependency to your Android project](https://central.sonatype.com/artifact/ai.sqlite/sync). +You can add sqlite-sync as a dependency to your Android project.
    Groovy DSL diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md index 19f7f7f..0128f78 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/ios.md @@ -16,8 +16,7 @@ This guide will walk you through setting up SQLite in Swift to load CloudsSync e ## 2. Download and Add CloudSync Framework -1. Download the latest version of `cloudsync-apple-xcframework` from: - https://github.com/sqliteai/sqlite-sync/releases +1. Download the latest version of `cloudsync-apple-xcframework` from here 2. In Xcode, click on your project name in the source tree (top left with the Xcode logo) @@ -49,7 +48,7 @@ You need a version of SQLite that supports loading extensions. You have two opti ### Option A: Download SQLite Amalgamation (Recommended) -1. Download the amalgamation from: https://sqlite.org/download.html +1. Download the amalgamation from here 2. Create a new folder called **SQLite** in your Swift project in Xcode 3. Copy `sqlite3.c` and `sqlite3.h` into this folder by dragging them in 4. Enable all targets and confirm @@ -205,4 +204,4 @@ This confirms that CloudSync is properly integrated and functional in your Swift ## Usage Example -Check out the [Swift Multiplatform app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/swift-multiplatform-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. +Check out the Swift Multiplatform app for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md index f0299ec..516e07e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/linux.md @@ -40,7 +40,7 @@ apk add sqlite ## 2. Download the Extension -Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) and download the extension. +Go to sqlite-sync releases and download the extension. > For Alpine Linux: ensure to download the extension specifically for `musl-x86_64` or `musl-arm64` targets. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md index ec222ba..66a8553 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/macos.md @@ -10,7 +10,7 @@ This guide explains how to install SQLite on macOS with support for loading exte ## macOS and xcframework -On recent versions of macOS, the recommended way to load a SQLite extension is through the [.xcframework](https://github.com/sqliteai/sqlite-extensions-guide/blob/main/platforms/ios.md) approach, the same method used on iOS. +On recent versions of macOS, the recommended way to load a SQLite extension is through the .xcframework approach, the same method used on iOS. ## macOS and dylib @@ -60,7 +60,7 @@ print("Extension loaded successfully.") ## Python on macOS The default Python on macOS doesn't support loading SQLite extensions. -Install Python from the [official package](https://www.python.org/downloads/macos/) or use Homebrew Python instead: +Install Python from the official package or use Homebrew Python instead: ```bash brew install python @@ -104,4 +104,4 @@ print(cursor.fetchone()) ## Usage Example -Check out the [Swift Multiplatform app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/swift-multiplatform-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. +Check out the Swift Multiplatform app for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md index c13237f..fe9c73e 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/react-native-expo.md @@ -37,7 +37,7 @@ npx expo prebuild ### Step 1: Download Android Extension -1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +1. Go to sqlite-sync releases 2. Download your preferred .zip architecture releases: - arm64-v8a - Modern 64-bit ARM devices (recommended for most users) - x86_64 - 64-bit x86 emulators and Intel-based devices @@ -64,7 +64,7 @@ Extract the `.so` files in the following directory structure: ### Step 1: Download iOS Extension -1. Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +1. Go to sqlite-sync releases 2. Download the `cloudsync-apple-xcframework-*.zip` 3. Extract `CloudSync.xcframework` @@ -166,4 +166,4 @@ const loadCloudSyncExtension = async () => { ## Usage Example -Check out the [Expo to-do-app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/to-do-app) for comprehensive usage examples and best practices. +Check out the Expo to-do-app for comprehensive usage examples and best practices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md index 837888f..18c84d4 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/wasm.md @@ -97,4 +97,4 @@ slug: sqlite-sync-quick-start-wasm ## Usage Example -Check out the [React/Vite app](https://github.com/sqliteai/sqlite-sync/tree/main/examples/sport-tracker-app) for a complete implementation of using the SQLite CloudSync extension to sync data across devices. +Check out the React/Vite app for a complete implementation of using the SQLite CloudSync extension to sync data across devices. diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md index 969148a..b3bc25f 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -11,7 +11,7 @@ This guide explains how to install SQLite on Windows with support for loading ex ## Using SQLite with Python 1. **Download Python** - Get the latest Python for Windows from [python.org](https://www.python.org/downloads/windows/). + Get the latest Python for Windows from python.org. 2. **Install Python** @@ -28,7 +28,7 @@ This guide explains how to install SQLite on Windows with support for loading ex ``` 4. **Download the Extension** - Go to [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) and download the extension. + Go to sqlite-sync releases and download the extension. 5. **Load Extension** @@ -65,8 +65,8 @@ This guide shows how to load a native SQLite extension (e.g., **`cloudsync.dll`* - Windows x64 - .NET 6+ SDK -- [NuGet package manager](https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools?tabs=windows) -- The native extension file: `cloudsync.dll` (x64 build) - download from [sqlite-sync releases](https://github.com/sqliteai/sqlite-sync/releases) +- NuGet package manager +- The native extension file: `cloudsync.dll` (x64 build) - download from sqlite-sync releases > **Important:** Your app, `e_sqlite3.dll` (bundled by `Microsoft.Data.Sqlite`), and `cloudsync.dll` must all be the **same architecture** (typically x64). @@ -74,7 +74,7 @@ This guide shows how to load a native SQLite extension (e.g., **`cloudsync.dll`* ### 1. Install the SQLite package -Install the [`Microsoft.Data.Sqlite`](https://www.nuget.org/packages/Microsoft.Data.Sqlite) NuGet package: +Install the `Microsoft.Data.Sqlite` NuGet package: ```bash dotnet add package Microsoft.Data.Sqlite diff --git a/sqlite-cloud/sqlite-ai/sqlite-vector.mdx b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx index 73bf90a..fce48c8 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-vector.mdx +++ b/sqlite-cloud/sqlite-ai/sqlite-vector.mdx @@ -6,8 +6,8 @@ status: publish slug: sqlite-vector --- -[SQLite-Vector](https://github.com/sqliteai/sqlite-vector) is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities directly into your embedded database +SQLite-Vector is a cross-platform, ultra-efficient SQLite extension that brings vector search capabilities directly into your embedded database Whether you're dealing with **millions of high-dimensional vectors** or operating on resource-constrained edge devices, SQLite-Vector delivers **lightning-fast performance** with a **tiny memory footprint**. -**SQLite-Vector** is an open-source project available on [GitHub](https://github.com/sqliteai/sqlite-vector). \ No newline at end of file +**SQLite-Vector** is an open-source project available on GitHub. \ No newline at end of file diff --git a/sqlite-cloud/tutorials/tutorial-geopoly.mdx b/sqlite-cloud/tutorials/tutorial-geopoly.mdx index e26b41a..0c75a9e 100644 --- a/sqlite-cloud/tutorials/tutorial-geopoly.mdx +++ b/sqlite-cloud/tutorials/tutorial-geopoly.mdx @@ -6,11 +6,11 @@ status: publish slug: tutorial-geopoly --- -In this tutorial you will build a local attractions finder map-plication using GeoJSON data, a SQLite Cloud database, [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/guides) (JavaScript Graphics Library), React, and SQLite's built-in [Geopoly extension](https://devdocs.io/sqlite/geopoly). +In this tutorial you will build a local attractions finder map-plication using GeoJSON data, a SQLite Cloud database, Mapbox GL JS (JavaScript Graphics Library), React, and SQLite's built-in Geopoly extension. **Time to complete: 15-20 mins.** -If you get stuck in the tutorial or prefer to play with the finished product, check out [the example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly-demo). +If you get stuck in the tutorial or prefer to play with the finished product, check out the example app on GitHub. --- @@ -25,9 +25,9 @@ npm init -y **2. Curate your GeoJSON data** - - We will leverage the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) (an open-source, read-only API for fetching OpenStreetMap data) to query NY attractions. + - We will leverage the Overpass API (an open-source, read-only API for fetching OpenStreetMap data) to query NY attractions. - - Visit [Overpass Turbo](https://overpass-turbo.eu/), the Overpass GUI. Copy and paste in the below query, which: + - Visit Overpass Turbo, the Overpass GUI. Copy and paste in the below query, which: - defines New York as the area of interest; - fetches nodes in the specified area that are tagged with the keys `amenity`, `historic`, `tourism`, `leisure`, etc.; and - outputs the data. @@ -106,13 +106,13 @@ out skel qt; **3. Create a new SQLite Cloud database** - - If you haven't already, [sign up for a SQLite Cloud account](https://dashboard.sqlitecloud.io/auth/sign-in) and create a new project. + - If you haven't already, sign up for a SQLite Cloud account and create a new project. - In your account dashboard's left nav, click Databases, then Create Database. Name your new database `geopoly-demo`. **4. Create a Mapbox account** - - [Sign up](https://account.mapbox.com/auth/signup/) for an Individual Mapbox account. (We'll stay on the free tier.) + - Sign up for an Individual Mapbox account. (We'll stay on the free tier.) **5. Set your environment variables** @@ -350,7 +350,7 @@ body { } ``` - - NOTE: To simplify this tutorial, `.marker.background-image` uses a custom Mapbox marker for the pins marking attractions on the map. [The example app on GitHub](https://github.com/sqlitecloud/examples/tree/main/geopoly) uses a custom marker image included in the repo's `images` dir (excluded here). + - NOTE: To simplify this tutorial, `.marker.background-image` uses a custom Mapbox marker for the pins marking attractions on the map. The example app on GitHub uses a custom marker image included in the repo's `images` dir (excluded here). `index.js` ```js @@ -787,7 +787,7 @@ npm start - On app load, the map is centered on Central Park, NY. - - In the geocoder (i.e. search input) at the top right of the map, enter "Empire" and click on the "Empire State Building" result. You can also search coordinates (see [reverse geocoding](https://docs.mapbox.com/api/search/geocoding/)). + - In the geocoder (i.e. search input) at the top right of the map, enter "Empire" and click on the "Empire State Building" result. You can also search coordinates (see reverse geocoding). - When you select a geocoder result: - a polygon is generated by Geopoly, added to your `polygons` table, and displayed on the map; and @@ -806,17 +806,17 @@ SELECT rowid, geopoly_json(_shape) FROM polygons; - You can click on any attraction listing or marker to fly/ zoom to and center on that attraction on the map. - - [Turf.js uses the Haversine formula](https://turfjs.org/docs/api/distance) to account for global curvature when calculating the distance between your searched location and each attraction. However, you should still expect discrepancies between this app's calculated distances vs, say, Google or Apple Maps. + - Turf.js uses the Haversine formula to account for global curvature when calculating the distance between your searched location and each attraction. However, you should still expect discrepancies between this app's calculated distances vs, say, Google or Apple Maps. And that’s it! You’ve successfully built a local attractions finder app that utilizes Geopoly to write geodata to and read from a SQLite Cloud database. ### Additional Guidance on Overpass: - - To fetch other attractions or any other kind of location data in NY or another area of interest to you, refer to [OpenStreetMap's Map features documentation](https://wiki.openstreetmap.org/wiki/Map_features). As a starting point, modify the area or key-value pairs in the NY query. + - To fetch other attractions or any other kind of location data in NY or another area of interest to you, refer to OpenStreetMap's Map features documentation. As a starting point, modify the area or key-value pairs in the NY query. - - NOTE: The app works only with Point features (represented in the [Map features](https://wiki.openstreetmap.org/wiki/Map_features) tables' `Element` columns by an icon with a single dot). Be sure to query only nodes and the key-value pairs that can return Point data. For example, don't use most of the values available for the Boundary key. + - NOTE: The app works only with Point features (represented in the Map features tables' `Element` columns by an icon with a single dot). Be sure to query only nodes and the key-value pairs that can return Point data. For example, don't use most of the values available for the Boundary key. - - To implement more complex or granular Point queries, refer to the [Overpass QL documentation](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL). + - To implement more complex or granular Point queries, refer to the Overpass QL documentation. - If you run a custom Overpass query: - Add to or replace the FeatureCollection in `geodata.json`. @@ -824,4 +824,4 @@ And that’s it! You’ve successfully built a local attractions finder app that - Create Database with the same name. - From your project dir, run `npm run create-tables`. Your database tables will be re-created, and the `attractions` table will be populated with your updated geodata. - - If you queried and stored attractions near your location, then after the app's initial load, click on the [GeolocateControl icon](https://docs.mapbox.com/mapbox-gl-js/example/locate-user/) at the top right of the map and allow the browser to quickly center the map on your location. Search away! \ No newline at end of file + - If you queried and stored attractions near your location, then after the app's initial load, click on the GeolocateControl icon at the top right of the map and allow the browser to quickly center the map on your location. Search away! \ No newline at end of file diff --git a/sqlite/json1.md b/sqlite/json1.md index 5ebf204..5085945 100644 --- a/sqlite/json1.md +++ b/sqlite/json1.md @@ -10,8 +10,8 @@ status: publish ## 1. Overview By default, SQLite supports twenty-nine functions and two operators for -dealing with JSON values. There are also two [table-valued -functions](https://sqlite.org/vtab.html#tabfunc2) that can be used to +dealing with JSON values. There are also two table-valued +functions that can be used to decompose a JSON string. There are 25 scalar functions and operators: @@ -52,7 +52,7 @@ There are four [aggregate SQL functions](lang_aggfunc.html): 3. [json_group_object](#jgroupobject)(*label*,*value*) 4. [jsonb_group_object](#jgroupobjectb)(name,*value*) -The two [table-valued functions](https://sqlite.org/vtab.html#tabfunc2) +The two table-valued functions are: 1. [json_each](#jeach)(*json*) @@ -91,11 +91,11 @@ function will usually throw an error. (Exceptions to this rule are [json_valid()](json1#jvalid), [json_quote()](json1#jquote), and [json_error_position()](json1#jerr).) -These routines understand all [rfc-8259 JSON -syntax](https://www.rfc-editor.org/rfc/rfc8259.txt) and also [JSON5 -extensions](https://spec.json5.org/). JSON text generated by these -routines always strictly conforms to the [canonical JSON -definition](https://json.org) and does not contain any JSON5 or other +These routines understand all rfc-8259 JSON +syntax and also JSON5 +extensions. JSON text generated by these +routines always strictly conforms to the canonical JSON +definition and does not contain any JSON5 or other extensions. The ability to read and understand JSON5 was added in version 3.42.0 (2023-05-16). Prior versions of SQLite would only read canonical JSON. @@ -126,7 +126,7 @@ JSONB is a binary representation of JSON used by SQLite and is intended for internal use by SQLite only. Applications should not use JSONB outside of SQLite nor try to reverse-engineer the JSONB format. -The "JSONB" name is inspired by [PostgreSQL](https://postgresql.org), +The "JSONB" name is inspired by PostgreSQL, but the on-disk format for SQLite's JSONB is not the same as PostgreSQL's. The two formats have the same name, but are not binary compatible. The PostgreSQL JSONB format claims to offer O(1) lookup of @@ -240,19 +240,19 @@ The current implementation of this JSON library uses a recursive descent parser. In order to avoid using excess stack space, any JSON input that has more than 1000 levels of nesting is considered invalid. Limits on nesting depth are allowed for compatible implementations of JSON by -[RFC-8259 section 9](https://tools.ietf.org/html/rfc8259#section-9). +RFC-8259 section 9. ## 3.6. JSON5 Extensions Beginning in version 3.42.0 (2023-05-16), these routines will read and -interpret input JSON text that includes [JSON5](https://spec.json5.org/) +interpret input JSON text that includes JSON5 extensions. However, JSON text generated by these routines will always -be strictly conforming to the [canonical definition of -JSON](https://json.org). +be strictly conforming to the canonical definition of +JSON. -Here is a synopsis of JSON5 extensions (adapted from the [JSON5 -specification](https://spec.json5.org/#introduction)): +Here is a synopsis of JSON5 extensions (adapted from the JSON5 +specification): - Object keys may be unquoted identifiers. - Objects may have a single trailing comma. @@ -699,7 +699,7 @@ is returned in the binary JSONB format. ## 4.14. The json_patch() function The json_patch(T,P) SQL function runs the -[RFC-7396](https://tools.ietf.org/html/rfc7396) MergePatch algorithm to +RFC-7396 MergePatch algorithm to apply patch P against input T. The patched copy of T is returned. MergePatch can add, modify, or delete elements of a JSON Object, and so @@ -919,8 +919,8 @@ the same except that they return their result in the binary ## 4.22. The json_each() and json_tree() table-valued functions -The json_each(X) and json_tree(X) [table-valued -functions](https://www.sqlite.org/vtab.html#tabfunc2) walk the JSON +The json_each(X) and json_tree(X) table-valued +functions walk the JSON value provided as their first argument and return one row for each element. The json_each(X) function only walks the immediate children of the top-level array or object, or just the top-level element itself if From eef6c017f87ddbfad883b9ff89485165f83d2231 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 6 Oct 2025 15:59:10 +0200 Subject: [PATCH 170/185] chore: windows.md code alignment --- .../sqlite-sync/quick-starts/windows.md | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md index b3bc25f..1397ad9 100644 --- a/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md +++ b/sqlite-cloud/sqlite-ai/sqlite-sync/quick-starts/windows.md @@ -11,6 +11,7 @@ This guide explains how to install SQLite on Windows with support for loading ex ## Using SQLite with Python 1. **Download Python** + Get the latest Python for Windows from python.org. 2. **Install Python** @@ -22,40 +23,40 @@ This guide explains how to install SQLite on Windows with support for loading ex 3. **Check your installation** Open Command Prompt and run: - ```bash - python --version - python -c "import sqlite3; print('SQLite version:', sqlite3.sqlite_version)" - ``` + ```bash + python --version + python -c "import sqlite3; print('SQLite version:', sqlite3.sqlite_version)" + ``` 4. **Download the Extension** + Go to sqlite-sync releases and download the extension. 5. **Load Extension** - - ```python - import sqlite3 - import os - - # Path to your compiled extension (.dll for Windows) - EXTENSION_PATH = os.path.abspath("cloudsync") - - # Connect to SQLite and enable extension loading - conn = sqlite3.connect(":memory:") - conn.enable_load_extension(True) - - # Load the extension - try: - conn.load_extension(EXTENSION_PATH) - print("Extension loaded successfully.") - except sqlite3.OperationalError as e: - print(f"Failed to load extension: {e}") - - conn.enable_load_extension(False) - - # Optionally test it (e.g., call a custom SQL function) - cursor = conn.execute("SELECT cloudsync_version();") - print(cursor.fetchone()) - ``` + ```python + import sqlite3 + import os + + # Path to your compiled extension (.dll for Windows) + EXTENSION_PATH = os.path.abspath("cloudsync") + + # Connect to SQLite and enable extension loading + conn = sqlite3.connect(":memory:") + conn.enable_load_extension(True) + + # Load the extension + try: + conn.load_extension(EXTENSION_PATH) + print("Extension loaded successfully.") + except sqlite3.OperationalError as e: + print(f"Failed to load extension: {e}") + + conn.enable_load_extension(False) + + # Optionally test it (e.g., call a custom SQL function) + cursor = conn.execute("SELECT cloudsync_version();") + print(cursor.fetchone()) + ``` ## Using SQLite with C# From 3eaa8a5d99c94c7e0d195772f683d247b841e4bf Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Wed, 8 Oct 2025 11:02:00 +0200 Subject: [PATCH 171/185] chore: process md,mdx files only --- .github/workflows/aisearch.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml index a850b67..b138cd5 100644 --- a/.github/workflows/aisearch.yaml +++ b/.github/workflows/aisearch.yaml @@ -23,3 +23,4 @@ jobs: base_url: ${{ vars.BASE_URL }} database_name: documentation_ai.sqlite source_files: ./ + only_extensions: "md,mdx" From e9eab67729e8cf5dca87962bf1298d24f1581b74 Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Thu, 16 Oct 2025 18:34:37 +0200 Subject: [PATCH 172/185] Add push trigger for main and stage branches --- .github/workflows/aisearch.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/aisearch.yaml b/.github/workflows/aisearch.yaml index 8a95192..c5e8eac 100644 --- a/.github/workflows/aisearch.yaml +++ b/.github/workflows/aisearch.yaml @@ -1,6 +1,10 @@ name: Process docs for SQLite AI Search on: + push: + branches: + - main + - stage workflow_dispatch: jobs: From 260a44c9878cbf5a88149b4c5e5910dcd61616cd Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Fri, 24 Oct 2025 15:48:32 +0200 Subject: [PATCH 173/185] feat(aisearch): aisearch-action guide --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 sqlite-cloud/sqlite-ai/aisearch-documents.mdx diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index d66e587..6bc103e 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -44,6 +44,7 @@ const sidebarNav: SidebarNavStruct = [ { title: "cloudsync_network_logout", filePath: "sqlite-sync-api-cloudsync-network-logout", type: "inner", level: 2 }, { title: "SQLite-Vector", filePath: "sqlite-vector", type: "inner", level: 0 }, { title: "MCP (Model Context Protocol)", filePath: "mcp-server", type: "inner", level: 0 }, + { title: "AI Search for your documents", filePath: "aisearch-documents", type: "inner", level: 0 }, // ### CLOUD ### { title: "Cloud", type: "secondary", icon: "docs-star",}, diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx new file mode 100644 index 0000000..d5c6f1a --- /dev/null +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -0,0 +1,65 @@ +--- +title: AI Search for your documents and files +description: SQLite AI Search for your documents and files +category: platform +status: publish +slug: aisearch-documents +--- + +This guide shows you how to set up a ready-to-use AI semantic search for your documents and files. +Using the [sqlite-aisearch-action](https://github.com/sqliteai/sqlite-aisearch-action), you can integrate document processing into your GitHub workflow and set up a chat bot on your site in just a few steps. + +The semantic search is powered by [SQLite RAG](https://github.com/sqliteai/sqlite-rag). + +## Set Up Your GitHub Workflow + +1. **Get Your Connection String**: Ensure you have a project on the [SQLite Cloud dashboard](https://dashboard.sqlitecloud.io). If not, sign up for [SQLite AI](https://sqlite.ai) to create one for free. + +2. **Set GitHub Secret**: Add your connection string as `SQLITECLOUD_CONNECTION_STRING` in your repository secrets. + +3. **Add to Workflow**: Create or update your GitHub workflow: + +```yaml +name: AI Search Index + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build-search: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build AI Search Database + uses: sqliteai/sqlite-aisearch-action@v1 + with: + connection_string: ${{ secrets.SQLITECLOUD_CONNECTION_STRING }} + base_url: https://docs.yoursite.com + database_name: aidocs_search.db + source_files: ./path/to/documents +``` + +## Create the Search Edge Function + +To enable search functionality on your indexed database, create an Edge Function using the provided template: + +1. Access your dashboard at https://dashboard.sqlitecloud.io +2. Navigate to the same project where your database was uploaded +3. Go to the **Edge Functions** section +![AISearch Edge Function](@docs-website-assets/aisearch-docs/edgefn_aisearch.png) +4. Create a new `Javascript Function` and copy the code from [aisearch-docs.js](https://github.com/sqliteai/sqlite-aisearch-action/blob/main/search_edge_function_template/aisearch-docs.js) into the editor +5. Deploy and test + +### How to Perform a Search + +1. Go to **Details** in the Edge Function panel and copy the **Function URL** +![AISearch Edge Function Details](@docs-website-assets/aisearch-docs/edgefn_aisearch_details.png) +2. Execute a GET request with a URL-encoded query as the `query` parameter + + Example: + ``` + GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F + ``` From 5dd6ccb640a394e439f23547bd5e0039e64e555c Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 24 Oct 2025 17:18:09 +0200 Subject: [PATCH 174/185] chore: update aisearch-documents w/ docs-chatbot integration --- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 62 ++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index d5c6f1a..c2a1d4a 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -7,11 +7,11 @@ slug: aisearch-documents --- This guide shows you how to set up a ready-to-use AI semantic search for your documents and files. -Using the [sqlite-aisearch-action](https://github.com/sqliteai/sqlite-aisearch-action), you can integrate document processing into your GitHub workflow and set up a chat bot on your site in just a few steps. +Using the [sqlite-aisearch-action](https://github.com/sqliteai/sqlite-aisearch-action), you can integrate document processing into your GitHub workflow and set up a chatbot on your site in just a few steps. The semantic search is powered by [SQLite RAG](https://github.com/sqliteai/sqlite-rag). -## Set Up Your GitHub Workflow +## Step 1: Set Up Your GitHub Workflow 1. **Get Your Connection String**: Ensure you have a project on the [SQLite Cloud dashboard](https://dashboard.sqlitecloud.io). If not, sign up for [SQLite AI](https://sqlite.ai) to create one for free. @@ -42,7 +42,7 @@ jobs: source_files: ./path/to/documents ``` -## Create the Search Edge Function +## Step 2: Create the Search Edge Function To enable search functionality on your indexed database, create an Edge Function using the provided template: @@ -63,3 +63,59 @@ To enable search functionality on your indexed database, create an Edge Function ``` GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F ``` + +## Integrate the Docs Chatbot in Your Website + +Once you have your search edge function deployed, you can easily add an interactive AI chatbot to your website. The chatbot provides a user-friendly interface for your documentation search, powered by the indexed content. + +### React Integration + +Install the chatbot package: + +```bash +npm install @sqliteai/docs-chatbot +``` + +Then add it to your React application: + +```tsx +import { DocsChatbot } from "@sqliteai/docs-chatbot"; +import "@sqliteai/docs-chatbot/style.css"; + +function App() { + return ( + + ); +} +``` + +### Vanilla JavaScript + +For non-React applications, use the web component: + +```html + + + + + + + + + + + + + +``` + +By default, the chatbot displays as a floating button in the bottom-right corner. +For advanced configuration options including custom triggers, theming, and API reference, see the [full docs chatbot documentation](https://github.com/sqliteai/docs-chatbot). From a661efdeab78aea5beab3b4e7bb860be9ca8036a Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 24 Oct 2025 17:21:00 +0200 Subject: [PATCH 175/185] chore: update aisearch-documents --- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index c2a1d4a..30da6c4 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -64,7 +64,7 @@ To enable search functionality on your indexed database, create an Edge Function GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F ``` -## Integrate the Docs Chatbot in Your Website +## Step 3: Integrate the Docs Chatbot in Your Website Once you have your search edge function deployed, you can easily add an interactive AI chatbot to your website. The chatbot provides a user-friendly interface for your documentation search, powered by the indexed content. From 5e9ff10d5cb9cfca2e24a9f6a1533446eb4c98d6 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 24 Oct 2025 17:32:19 +0200 Subject: [PATCH 176/185] chore: aisearch-documents - add image for chatbot --- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index 30da6c4..710a097 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -68,6 +68,8 @@ To enable search functionality on your indexed database, create an Edge Function Once you have your search edge function deployed, you can easily add an interactive AI chatbot to your website. The chatbot provides a user-friendly interface for your documentation search, powered by the indexed content. +![Docs Chatbot](@docs-website-assets/aisearch-docs/docs_chatbot.png) + ### React Integration Install the chatbot package: From eea2b8ea0010458d432fc44c9000b9695e01a463 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Fri, 24 Oct 2025 17:38:17 +0200 Subject: [PATCH 177/185] chore: aisearch-documents - update title and section name --- sqlite-cloud/_nav.ts | 351 ++++++++++++++---- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 2 +- 2 files changed, 284 insertions(+), 69 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 6bc103e..8919cfc 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -3,87 +3,302 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, // ### AI ### - { title: "AI", type: "secondary", icon: "docs-star",}, + { title: "AI", type: "secondary", icon: "docs-star" }, { title: "Overview", filePath: "ai-overview", type: "inner", level: 0 }, { title: "SQLite-AI", filePath: "sqlite-ai", type: "inner", level: 0 }, { title: "SQLite-JS", filePath: "sqlite-js", type: "inner", level: 0 }, { title: "SQLite-Sync", type: "inner", level: 0 }, - { title: "Introduction", filePath: "sqlite-sync-introduction", type: "inner", level: 1 }, - { title: "Getting Started", filePath: "sqlite-sync-getting-started", type: "inner", level: 1 }, - { title: "Best Practices", filePath: "sqlite-sync-best-practices", type: "inner", level: 1 }, - { title: "Quick Starts", type: "inner", level: 1 }, - { title: "Android", filePath: "sqlite-sync-quick-start-android", type: "inner", level: 2 }, - { title: "iOS", filePath: "sqlite-sync-quick-start-ios", type: "inner", level: 2 }, - { title: "Linux", filePath: "sqlite-sync-quick-start-linux", type: "inner", level: 2 }, - { title: "macOS", filePath: "sqlite-sync-quick-start-macos", type: "inner", level: 2 }, - { title: "React Native Expo", filePath: "sqlite-sync-quick-start-expo", type: "inner", level: 2 }, - { title: "WASM", filePath: "sqlite-sync-quick-start-wasm", type: "inner", level: 2 }, - { title: "Windows", filePath: "sqlite-sync-quick-start-windows", type: "inner", level: 2 }, - { title: "API Reference", type: "inner", level: 1 }, - { title: "cloudsync_init", filePath: "sqlite-sync-api-cloudsync-init", type: "inner", level: 2 }, - { title: "cloudsync_enable", filePath: "sqlite-sync-api-cloudsync-enable", type: "inner", level: 2 }, - { title: "cloudsync_disable", filePath: "sqlite-sync-api-cloudsync-disable", type: "inner", level: 2 }, - { title: "cloudsync_is_enabled", filePath: "sqlite-sync-api-cloudsync-is-enabled", type: "inner", level: 2 }, - { title: "cloudsync_cleanup", filePath: "sqlite-sync-api-cloudsync-cleanup", type: "inner", level: 2 }, - { title: "cloudsync_terminate", filePath: "sqlite-sync-api-cloudsync-terminate", type: "inner", level: 2 }, - { title: "cloudsync_version", filePath: "sqlite-sync-api-cloudsync-version", type: "inner", level: 2 }, - { title: "cloudsync_siteid", filePath: "sqlite-sync-api-cloudsync-siteid", type: "inner", level: 2 }, - { title: "cloudsync_db_version", filePath: "sqlite-sync-api-cloudsync-db-version", type: "inner", level: 2 }, - { title: "cloudsync_uuid", filePath: "sqlite-sync-api-cloudsync-uuid", type: "inner", level: 2 }, - { title: "cloudsync_begin_alter", filePath: "sqlite-sync-api-cloudsync-begin-alter", type: "inner", level: 2 }, - { title: "cloudsync_commit_alter", filePath: "sqlite-sync-api-cloudsync-commit-alter", type: "inner", level: 2 }, - { title: "cloudsync_network_init", filePath: "sqlite-sync-api-cloudsync-network-init", type: "inner", level: 2 }, - { title: "cloudsync_network_cleanup", filePath: "sqlite-sync-api-cloudsync-network-cleanup", type: "inner", level: 2 }, - { title: "cloudsync_network_set_token", filePath: "sqlite-sync-api-cloudsync-network-set-token", type: "inner", level: 2 }, - { title: "cloudsync_network_set_apikey", filePath: "sqlite-sync-api-cloudsync-network-set-apikey", type: "inner", level: 2 }, - { title: "cloudsync_network_has_unsent_changes", filePath: "sqlite-sync-api-cloudsync-network-has-unsent-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_send_changes", filePath: "sqlite-sync-api-cloudsync-network-send-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_check_changes", filePath: "sqlite-sync-api-cloudsync-network-check-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_sync", filePath: "sqlite-sync-api-cloudsync-network-sync", type: "inner", level: 2 }, - { title: "cloudsync_network_reset_sync_version", filePath: "sqlite-sync-api-cloudsync-network-reset-sync-version", type: "inner", level: 2 }, - { title: "cloudsync_network_logout", filePath: "sqlite-sync-api-cloudsync-network-logout", type: "inner", level: 2 }, - { title: "SQLite-Vector", filePath: "sqlite-vector", type: "inner", level: 0 }, - { title: "MCP (Model Context Protocol)", filePath: "mcp-server", type: "inner", level: 0 }, - { title: "AI Search for your documents", filePath: "aisearch-documents", type: "inner", level: 0 }, + { + title: "Introduction", + filePath: "sqlite-sync-introduction", + type: "inner", + level: 1, + }, + { + title: "Getting Started", + filePath: "sqlite-sync-getting-started", + type: "inner", + level: 1, + }, + { + title: "Best Practices", + filePath: "sqlite-sync-best-practices", + type: "inner", + level: 1, + }, + { title: "Quick Starts", type: "inner", level: 1 }, + { + title: "Android", + filePath: "sqlite-sync-quick-start-android", + type: "inner", + level: 2, + }, + { + title: "iOS", + filePath: "sqlite-sync-quick-start-ios", + type: "inner", + level: 2, + }, + { + title: "Linux", + filePath: "sqlite-sync-quick-start-linux", + type: "inner", + level: 2, + }, + { + title: "macOS", + filePath: "sqlite-sync-quick-start-macos", + type: "inner", + level: 2, + }, + { + title: "React Native Expo", + filePath: "sqlite-sync-quick-start-expo", + type: "inner", + level: 2, + }, + { + title: "WASM", + filePath: "sqlite-sync-quick-start-wasm", + type: "inner", + level: 2, + }, + { + title: "Windows", + filePath: "sqlite-sync-quick-start-windows", + type: "inner", + level: 2, + }, + { title: "API Reference", type: "inner", level: 1 }, + { + title: "cloudsync_init", + filePath: "sqlite-sync-api-cloudsync-init", + type: "inner", + level: 2, + }, + { + title: "cloudsync_enable", + filePath: "sqlite-sync-api-cloudsync-enable", + type: "inner", + level: 2, + }, + { + title: "cloudsync_disable", + filePath: "sqlite-sync-api-cloudsync-disable", + type: "inner", + level: 2, + }, + { + title: "cloudsync_is_enabled", + filePath: "sqlite-sync-api-cloudsync-is-enabled", + type: "inner", + level: 2, + }, + { + title: "cloudsync_cleanup", + filePath: "sqlite-sync-api-cloudsync-cleanup", + type: "inner", + level: 2, + }, + { + title: "cloudsync_terminate", + filePath: "sqlite-sync-api-cloudsync-terminate", + type: "inner", + level: 2, + }, + { + title: "cloudsync_version", + filePath: "sqlite-sync-api-cloudsync-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_siteid", + filePath: "sqlite-sync-api-cloudsync-siteid", + type: "inner", + level: 2, + }, + { + title: "cloudsync_db_version", + filePath: "sqlite-sync-api-cloudsync-db-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_uuid", + filePath: "sqlite-sync-api-cloudsync-uuid", + type: "inner", + level: 2, + }, + { + title: "cloudsync_begin_alter", + filePath: "sqlite-sync-api-cloudsync-begin-alter", + type: "inner", + level: 2, + }, + { + title: "cloudsync_commit_alter", + filePath: "sqlite-sync-api-cloudsync-commit-alter", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_init", + filePath: "sqlite-sync-api-cloudsync-network-init", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_cleanup", + filePath: "sqlite-sync-api-cloudsync-network-cleanup", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_set_token", + filePath: "sqlite-sync-api-cloudsync-network-set-token", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_set_apikey", + filePath: "sqlite-sync-api-cloudsync-network-set-apikey", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_has_unsent_changes", + filePath: "sqlite-sync-api-cloudsync-network-has-unsent-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_send_changes", + filePath: "sqlite-sync-api-cloudsync-network-send-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_check_changes", + filePath: "sqlite-sync-api-cloudsync-network-check-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_sync", + filePath: "sqlite-sync-api-cloudsync-network-sync", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_reset_sync_version", + filePath: "sqlite-sync-api-cloudsync-network-reset-sync-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_logout", + filePath: "sqlite-sync-api-cloudsync-network-logout", + type: "inner", + level: 2, + }, + { + title: "SQLite-Vector", + filePath: "sqlite-vector", + type: "inner", + level: 0, + }, + { + title: "MCP (Model Context Protocol)", + filePath: "mcp-server", + type: "inner", + level: 0, + }, + { + title: "AI-Powered Docs Search", + filePath: "aisearch-documents", + type: "inner", + level: 0, + }, // ### CLOUD ### - { title: "Cloud", type: "secondary", icon: "docs-star",}, + { title: "Cloud", type: "secondary", icon: "docs-star" }, { title: "Overview", filePath: "overview", type: "inner", level: 0 }, { title: "Scaling", filePath: "architecture", type: "inner", level: 0 }, { title: "Getting Started", type: "inner", level: 0 }, - { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, - { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, - { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { + title: "Creating a database", + filePath: "create-database", + type: "inner", + level: 1, + }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, - { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, - { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, - { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, - { title: "Knex.js", filePath: "quick-start-knex", type: "inner", level: 1 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + { + title: "React Native", + filePath: "quick-start-react-native", + type: "inner", + level: 1, + }, + { + title: "Apollo / GraphQL", + filePath: "quick-start-apollo-graphql", + type: "inner", + level: 1, + }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + filePath: "quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + { + title: "Streamlit", + filePath: "quick-start-streamlit", + type: "inner", + level: 1, + }, + { + title: "PHP / Laravel", + filePath: "quick-start-php-laravel", + type: "inner", + level: 1, + }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Knex.js", filePath: "quick-start-knex", type: "inner", level: 1 }, // ### PLATFORM ### { title: "Platform", type: "secondary", icon: "docs-plat" }, - { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, - { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, - { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, - //{ title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Users and Roles", filePath: "security", type: "inner", level: 0 }, - { title: "API Keys", filePath: "apikey", type: "inner", level: 0 }, - { title: "Row-Level Security", filePath: "rls", type: "inner", level: 0}, - { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, - { title: "Access Tokens", filePath: "access-tokens", type: "inner", level: 0 }, - { title: "Backups", filePath: "backups", type: "inner", level: 0 }, - { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, - { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, - { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, + { + title: "Edge Functions", + filePath: "edge-functions", + type: "inner", + level: 0, + }, + { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, + { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + //{ title: "Vector", filePath: "vector", type: "inner", level: 0 }, + { title: "Users and Roles", filePath: "security", type: "inner", level: 0 }, + { title: "API Keys", filePath: "apikey", type: "inner", level: 0 }, + { title: "Row-Level Security", filePath: "rls", type: "inner", level: 0 }, + { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, + { + title: "Access Tokens", + filePath: "access-tokens", + type: "inner", + level: 0, + }, + { title: "Backups", filePath: "backups", type: "inner", level: 0 }, + { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, // ### CLOUD SDK ### { title: "Cloud SDK", type: "secondary", icon: "docs-sdk" }, diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index 710a097..1ec09a4 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -1,5 +1,5 @@ --- -title: AI Search for your documents and files +title: Build AI Search for Your Documentation description: SQLite AI Search for your documents and files category: platform status: publish From 9b58009e4813e6a1787e0cfdecbdd5d427edd5d9 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 27 Oct 2025 10:43:04 +0100 Subject: [PATCH 178/185] chore: aisearch-documents - add callout for api key and search url --- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index 1ec09a4..4c3ea20 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -6,6 +6,8 @@ status: publish slug: aisearch-documents --- +import Callout from "@commons-components/Information/Callout.astro"; + This guide shows you how to set up a ready-to-use AI semantic search for your documents and files. Using the [sqlite-aisearch-action](https://github.com/sqliteai/sqlite-aisearch-action), you can integrate document processing into your GitHub workflow and set up a chatbot on your site in just a few steps. @@ -32,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + - name: Build AI Search Database uses: sqliteai/sqlite-aisearch-action@v1 with: @@ -49,20 +51,21 @@ To enable search functionality on your indexed database, create an Edge Function 1. Access your dashboard at https://dashboard.sqlitecloud.io 2. Navigate to the same project where your database was uploaded 3. Go to the **Edge Functions** section -![AISearch Edge Function](@docs-website-assets/aisearch-docs/edgefn_aisearch.png) + ![AISearch Edge Function](@docs-website-assets/aisearch-docs/edgefn_aisearch.png) 4. Create a new `Javascript Function` and copy the code from [aisearch-docs.js](https://github.com/sqliteai/sqlite-aisearch-action/blob/main/search_edge_function_template/aisearch-docs.js) into the editor 5. Deploy and test ### How to Perform a Search 1. Go to **Details** in the Edge Function panel and copy the **Function URL** -![AISearch Edge Function Details](@docs-website-assets/aisearch-docs/edgefn_aisearch_details.png) + ![AISearch Edge Function Details](@docs-website-assets/aisearch-docs/edgefn_aisearch_details.png) 2. Execute a GET request with a URL-encoded query as the `query` parameter - Example: - ``` - GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F - ``` + Example: + + ``` + GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F + ``` ## Step 3: Integrate the Docs Chatbot in Your Website @@ -95,6 +98,13 @@ function App() { } ``` + + - Replace the `searchUrl` with your **Function URL** from Step 2 + - For the `apiKey`, you need to use your admin API key or an API key with read + permissions on your AI docs database. Learn how to create and manage API keys + in the [API Key documentation](/docs/apikey). + + ### Vanilla JavaScript For non-React applications, use the web component: From b5c46c15ab06346386bb25d95d3e6211b070a470 Mon Sep 17 00:00:00 2001 From: damlayildiz Date: Mon, 27 Oct 2025 10:46:29 +0100 Subject: [PATCH 179/185] chore: update aisearch-documents --- sqlite-cloud/sqlite-ai/aisearch-documents.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx index 4c3ea20..e3f7588 100644 --- a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -100,7 +100,7 @@ function App() { - Replace the `searchUrl` with your **Function URL** from Step 2 - - For the `apiKey`, you need to use your admin API key or an API key with read + - For the `apiKey`, you need to use an API key with read permissions on your AI docs database. Learn how to create and manage API keys in the [API Key documentation](/docs/apikey). From 668ee69b7934a52aacefa2abe89c2cfaf10d91ee Mon Sep 17 00:00:00 2001 From: Tiziano Tuccella Date: Mon, 27 Oct 2025 16:47:53 +0100 Subject: [PATCH 180/185] Update README.mb --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 941e356..4d0dcde 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,5 @@ status: publish # SQLite Cloud Documentation The content folder contains all the documentation files that the docs.sqlitecloud.io website imports. -These pages are open source and can be edited by anyone. +These pages are open source and can be edited by anyone. Just submit a pull request. From 11a75aa8b9a40ce5aaa7b3e6b95637a18064fb78 Mon Sep 17 00:00:00 2001 From: Tiziano Tuccella Date: Mon, 27 Oct 2025 17:18:56 +0100 Subject: [PATCH 181/185] chore: trigger build --- sqlite-cloud/_nav.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 8919cfc..7ada738 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -1,5 +1,7 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; + + const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, // ### AI ### From 7db05f24e2b714a00a5d804b012fbbbdcbf37089 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 1 Dec 2025 09:42:18 +0100 Subject: [PATCH 182/185] chore(docs): improve Query Analyzer documentation Enhance analyzer.mdx with clearer instructions and better organization: - Add detailed Getting Started section with dropdown menu instructions - Include warning callout about Analyzer being a debugging tool - Expand Testing section with step-by-step guidance - Add new "Analyzing Performance and Applying Suggestions" section - Improve formatting and readability throughout --- sqlite-cloud/platform/analyzer.mdx | 31 +++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/sqlite-cloud/platform/analyzer.mdx b/sqlite-cloud/platform/analyzer.mdx index 9338584..a0c67fb 100644 --- a/sqlite-cloud/platform/analyzer.mdx +++ b/sqlite-cloud/platform/analyzer.mdx @@ -9,6 +9,8 @@ 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'; +import Callout from "@commons-components/Information/Callout.astro"; + 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. @@ -16,21 +18,40 @@ The Analyzer panel is a powerful tool that collects and categorizes all the quer ## 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. +By default, the Analyzer is disabled to avoid unnecessary overhead. You can enable it directly from the top-left dropdown menu in the Analyzer panel. + +Simply click on the dropdown (initially labeled **Disabled**) and select a monitoring threshold. You can choose a preset value (e.g., **Threshold 10ms**, **Threshold 100ms**) or define a **Custom Threshold**. Only queries taking longer than the selected time (in milliseconds) will be recorded and analyzed. + + + +Query Analyzer is a **debugging tool**.
    It's recommended to keep it active only for the time strictly necessary to identify and optimize queries. +
    + + + ---- ## 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'`; +To test the Analyzer, we can navigate to the `Studio -> chinook.sqlite -> SQL Console` section and perform a query that filters the non-indexed `Composer` column of the `Track` table using the following statement: + +`SELECT * FROM Tracks WHERE Composer = 'AC/DC';` + +Once the query is executed, return to the **Analyzer** panel. You will see the query listed in the table along with execution statistics, such as **Count**, **Avg. Time (ms)**, and **Max Time (ms)**. +### Analyzing Performance and Applying Suggestions -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. +Click on the query row to open the **Query Details** side panel. This panel provides in-depth information organized into three tabs: +1. **Query**: Displays the full SQL statement (with an option to copy it). +2. **Current Execution Plan**: Shows how the database engine currently processes the query (e.g., `SCAN TABLE` indicates a full table scan, which is often inefficient). +3. **Index Suggestions**: This is the most critical section for optimization. It displays **Candidate Indexes** and a **Suggested Index**. -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. +To optimize your database performance, navigate to the **Index Suggestions** tab. +If an optimization is available, you will see a proposed `CREATE INDEX` statement. -To apply the recommended index(es), simply select **Apply** and they will be automatically written and distributed in the `Chinook.sqlite` database. +Simply click the **Apply All Suggestions** button. The Analyzer will automatically create and distribute the optimal index in the `chinook.sqlite` database, speeding up future queries filtered by the `Composer` column. \ No newline at end of file From e6b0c9d3752a731a0dedc8a2f9f841a4c7abf4fc Mon Sep 17 00:00:00 2001 From: TizianoT Date: Mon, 1 Dec 2025 09:54:54 +0100 Subject: [PATCH 183/185] chore(docs): update analyzer title to query analyzer Update the title and first paragraph to consistently use "Query Analyzer" instead of just "Analyzer" for better clarity. --- sqlite-cloud/platform/analyzer.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlite-cloud/platform/analyzer.mdx b/sqlite-cloud/platform/analyzer.mdx index a0c67fb..42ffac4 100644 --- a/sqlite-cloud/platform/analyzer.mdx +++ b/sqlite-cloud/platform/analyzer.mdx @@ -1,5 +1,5 @@ --- -title: Analyzer +title: Query Analyzer description: The Analyzer panel is a powerful tool that collects and categorizes all the queries executed on your cluster based on their execution time. category: platform status: publish @@ -12,7 +12,7 @@ import applyAnalyzer from '@docs-website-assets/introduction/video/dashboard_ana import Callout from "@commons-components/Information/Callout.astro"; -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. +The Query 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. --- From 3b31a19fb8c1edf74c36c0a18fda855e8acb02a9 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 2 Dec 2025 14:29:55 +0100 Subject: [PATCH 184/185] docs: add logs documentation for SQLite Cloud platform Add comprehensive documentation for the Logs feature, including log monitoring, filtering options, and detailed viewing capabilities. --- sqlite-cloud/platform/logs.mdx | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sqlite-cloud/platform/logs.mdx diff --git a/sqlite-cloud/platform/logs.mdx b/sqlite-cloud/platform/logs.mdx new file mode 100644 index 0000000..2240e67 --- /dev/null +++ b/sqlite-cloud/platform/logs.mdx @@ -0,0 +1,104 @@ +--- +title: Logs +description: View detailed insights into your SQLite Cloud project's operations to monitor activity, debug issues, and track system behavior in real time. +category: platform +status: publish +slug: logs +--- +import VideoPlayer from '@commons-components/Video/VideoPlayer.astro'; +import logsVideo from '@docs-website-assets/introduction/video/dashboard_logs.mp4'; + + +Logs provide detailed insights into your SQLite Cloud project's operations, helping you monitor activity, debug issues, and track system behavior in real time. The Logs panel displays a comprehensive view of all events occurring across your cluster nodes. + + + +--- + +## Key Features + +- **Log Monitoring**: View recent log entries with manual refresh capability to get the latest activity +- **Filtering Options**: Filter logs by time range, specific nodes, and search through messages +- **Detailed Context**: Each log entry includes timestamp, severity level, source, and detailed message information + +--- + +## Accessing Logs + +Navigate to the **Logs** section from your SQLite Cloud dashboard to view your project's log entries. The interface displays logs in a table format with the following columns: + +- **Time**: Timestamp when the event occurred (in UTC) +- **Level**: Severity level of the log entry (e.g., ERROR, INFO, WARNING) +- **Source**: Component or service that generated the log +- **Log Type**: Category of the log entry (e.g., CLIENT, SYSTEM) +- **Message**: Detailed description of the logged event + +--- + +## Filtering Logs + +### Timestamp Range + +Use the timestamp range selector to filter logs by time period. Available options include: + +- Last 30 minutes +- Last hour +- Last 12 hours +- Last day +- Last 3 days +- Last week +- Last 2 weeks +- Last 30 days +- Custom date range (using the calendar picker) + +### Node Filtering + +Filter logs by specific cluster nodes using the **Nodes** section on the left sidebar. You can: + +- Search for specific nodes using the search box +- Select individual nodes to view their logs +- View the node location (e.g., US East) + +### Search Logs + +Use the search box at the top of the logs table to filter entries by message content. This helps you quickly locate specific errors or events. + +--- + +## Viewing Log Details + +Click on any log entry to view detailed information in the **Log Details** panel. This panel displays: + +- **Timestamp**: Exact time of the event +- **Level**: Severity level +- **Source**: Originating component +- **Node ID**: Specific node that generated the log +- **Log Type**: Category of the event +- **Message**: Full message with complete error details or event information + +### Actions + +- **Close**: Close the details panel +- **Copy JSON**: Copy the complete log entry in JSON format for further analysis or sharing + +--- + +## Refreshing Logs + +Click the **Refresh** button in the top-right corner to manually update the log list and view the most recent entries. This ensures you're viewing the latest activity from your cluster. + +--- + +## Common Use Cases + +### Debugging Errors + +When troubleshooting issues, filter logs by ERROR level and the relevant time period to quickly identify problems. For example, database constraint violations, connection issues, or query errors will appear in the logs with detailed error messages. + +### Monitoring Activity + +Track client connections, query executions, and system events by reviewing logs across different log types and sources. This helps you understand usage patterns and system behavior. + +### Performance Analysis + +Review logs during specific time periods to correlate events with performance issues or unexpected behavior in your application. From 03451956072964f026a3f542ab7aed15c28ded66 Mon Sep 17 00:00:00 2001 From: TizianoT Date: Tue, 2 Dec 2025 15:34:18 +0100 Subject: [PATCH 185/185] chore(docs): update logs documentation and navigation --- sqlite-cloud/_nav.ts | 1 + sqlite-cloud/platform/logs.mdx | 28 ++++------------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index 7ada738..ec1fb7b 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -299,6 +299,7 @@ const sidebarNav: SidebarNavStruct = [ }, { title: "Backups", filePath: "backups", type: "inner", level: 0 }, { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Logs", filePath: "logs", type: "inner", level: 0 }, { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, diff --git a/sqlite-cloud/platform/logs.mdx b/sqlite-cloud/platform/logs.mdx index 2240e67..f7a511b 100644 --- a/sqlite-cloud/platform/logs.mdx +++ b/sqlite-cloud/platform/logs.mdx @@ -11,7 +11,6 @@ import logsVideo from '@docs-website-assets/introduction/video/dashboard_logs.mp Logs provide detailed insights into your SQLite Cloud project's operations, helping you monitor activity, debug issues, and track system behavior in real time. The Logs panel displays a comprehensive view of all events occurring across your cluster nodes. - --- @@ -21,6 +20,8 @@ Logs provide detailed insights into your SQLite Cloud project's operations, help - **Filtering Options**: Filter logs by time range, specific nodes, and search through messages - **Detailed Context**: Each log entry includes timestamp, severity level, source, and detailed message information + + --- ## Accessing Logs @@ -28,9 +29,9 @@ Logs provide detailed insights into your SQLite Cloud project's operations, help Navigate to the **Logs** section from your SQLite Cloud dashboard to view your project's log entries. The interface displays logs in a table format with the following columns: - **Time**: Timestamp when the event occurred (in UTC) -- **Level**: Severity level of the log entry (e.g., ERROR, INFO, WARNING) +- **Level**: Severity level of the log entry - **Source**: Component or service that generated the log -- **Log Type**: Category of the log entry (e.g., CLIENT, SYSTEM) +- **Log Type**: Category of the log entry - **Message**: Detailed description of the logged event --- @@ -76,29 +77,8 @@ Click on any log entry to view detailed information in the **Log Details** panel - **Log Type**: Category of the event - **Message**: Full message with complete error details or event information -### Actions - -- **Close**: Close the details panel -- **Copy JSON**: Copy the complete log entry in JSON format for further analysis or sharing - --- ## Refreshing Logs Click the **Refresh** button in the top-right corner to manually update the log list and view the most recent entries. This ensures you're viewing the latest activity from your cluster. - ---- - -## Common Use Cases - -### Debugging Errors - -When troubleshooting issues, filter logs by ERROR level and the relevant time period to quickly identify problems. For example, database constraint violations, connection issues, or query errors will appear in the logs with detailed error messages. - -### Monitoring Activity - -Track client connections, query executions, and system events by reviewing logs across different log types and sources. This helps you understand usage patterns and system behavior. - -### Performance Analysis - -Review logs during specific time periods to correlate events with performance issues or unexpected behavior in your application.