OrbisDB aims to provide a universal experience when building with decentralized data. We made sure to build multiple ways for users to explore their data.
Unlike writes and updates, querying data from OrbisDB does not rely on Ceramic. Once data gets indexed, it is server directly from your OrbisDB instance.
Your application and users will interface with OrbisDB directly to query data and get the results they need. This can be done using our Data dashboard (link), SDK with an ORM-like interface or GraphQL.
SELECT
in OrbisDBOrbisDB indexing is backend by PostgreSQL. This allows users maximum flexibility when managing and querying their data.
Data dashboard SQL queries use a private API with both read and write permissions.
Data stored in the OrbisDB can be viewed through our Data dashboard. This is usually the first point of contact with your decentralized data as it’s simple to use and ready-to-go.
You can start exploring your OrbisDB data by visiting the Data
section of your OrbisDB Dashboard. Here you’ll see all the tables (Models) that are currently being indexed. You can browse them directly or use our Editor
to write custom SQL or GraphQL queries.
Check out more in our Dashboard reference (link).
Queries ran using the SDK go through the public API interface and are ran using a read-only PostgreSQL user. This prevents any malicious query attempts at the DB level.
While not an ORM, OrbisDB SDK comes with a simple query builder. This allows you to programmatically build SQL queries without having to know any SQL in the first place.
Queries get serialized as JSON and sent over a public REST API.
Check out our SDK reference (link) to explore more advanced queries, operators and more.
SELECT
The below code sample will select all rows that match columnName = 'value'
, returning all columns.
const { columns, rows } = await orbis
.select()
.from("MODEL_ID" | "MODEL_ALIAS" | "VIEW")
.where(
{
column_name: "value"
}
)
.context("CONTEXT_ID")
.run()
// SELECT * FROM table WHERE column_name = 'value';
console.log("Retrieved data", rows)