Interacting with your data in Squid
Create powerful queries and perform mutations on any database with the Squid Client SDK.
Squid lets you connect any database and interact with your data using the Squid Client SDK. Whether SQL or NoSQL, you can insert or update data and perform complex queries using the same streamlined methods provided in the SDK. You can even perform joins across database integrations, allowing you to connect completely separate data sources with a few lines of code.
Connecting your database
When you create a Squid app in the Squid Console, a built-in NoSQL database is provided out of the box for both the dev and prod environments. This means you can start developing right away without having to connect any data source.
To connect an existing data source to your Squid app, select the Integrations tab in the Squid Console, click Available Integrations, select the database type from the list, and then provide the database details. Each database type requires a different set of details depending on the requirements of that product. To view instructions for connecting your database, view the database integrations documentation.
Working with data
Concepts
The Squid Client SDK interacts with your data through a structure of collections and documents. A collection can be thought of as a table in a SQL database, or a collection of documents in a NoSQL database. A document can be thought of as a row in a table for a SQL database, or a document in a NoSQL database. No matter the data source, you interact with your data using this same structure.
// A reference to a collection in a database
const collectionRef = squid.collection<User>('users', 'INTEGRATION_ID');
// A reference to a specific document in the collection
const docRef = collectionRef.doc({ id: 'my_custom_id' });
To learn the foundations of working with data in Squid, check out the following guides:
Querying data
The Client SDK simplifies querying individual or multiple documents.. You can also set up data streaming to keep your query results up-to-date in real-time.
To learn about building queries in Squid, view the following guides:
Modifying data
Inserting, updating, and deleting documents is simple using the Client SDK. Follow these guides to find out how to mutate your data:
Query with AI
Squid provides the capability to query any database through natural language using Query with AI. When you provide a prompt to Query with AI, Squid performs the appropriate query for you and provides the results. You can also use Query with AI to generate charts and graphs of your data, providing insights on the fly without the need to write complex data queries.
You can access Query with AI in the Squid Console or programmatically using the Squid SDK.
To learn more, view the Query with AI documentation.
Explore
🗂️ Collection reference
A collection reference is a reference to a collection of documents (NoSQL) or a row of a table (SQL) in a database.
📑 Document reference
A document reference is a reference to a specific record in a collection. You can use it to read or write data to the document.
🪪 Document IDs
Document IDs are unique identifiers of a document that can be automatically generated by the server or manually specified by the user.
🔍 Queries
Create fine-grained queries for your data from any source, including joining data across multiple databases with real-time query support.
🧬 Mutations
Mutations refer to actions that modify the data of a document. They provide a fast and responsive user experience using optimistic updates.
🔁 Transactions
Perform multiple mutations on one or more documents in an atomic manner for better performance at scale.
🏠 Native queries
Execute raw SQL or other database-specific queries directly against the database.