diff --git a/docs/.vuepress/sidebar.ts b/docs/.vuepress/sidebar.ts index 7363c5b8c81..d313d00f4ea 100644 --- a/docs/.vuepress/sidebar.ts +++ b/docs/.vuepress/sidebar.ts @@ -492,6 +492,7 @@ export const getSidebar = (locale: string) => `${locale}/indexer/run_publish/query/graphql.md`, `${locale}/indexer/run_publish/query/aggregate.md`, `${locale}/indexer/run_publish/query/subscription.md`, + `${locale}/indexer/run_publish/query/subgraph.md`, ], }, { diff --git a/docs/indexer/build/graph-migration.md b/docs/indexer/build/graph-migration.md index b4f97fdff48..10a54180e1a 100644 --- a/docs/indexer/build/graph-migration.md +++ b/docs/indexer/build/graph-migration.md @@ -2,10 +2,10 @@ ::: info Hosting existing Subgraphs during migration -SubQuery provides a superior indexing SDK to Subgraphs and this document outlines the migration process. However SubQuery also provides a one-step migration for **hosting** your Subgraphs on The Graph’s hosted service / decentralized network, or other Subgraph hosting service. This is a drop-in replacement with the following benefits: +SubQuery provides a superior indexing SDK to Subgraphs and this document outlines the migration process. However SubQuery also provides a one-step migration for **hosting** your Subgraphs on The Graph’s hosted service / decentralised network, or other Subgraph hosting service. This is a drop-in replacement with the following benefits: - A enterprise level hosting platform with targeted 99.9% uptime -- Blue/green hotswap deployments of subgraphs, allowing for seamless updates on your frontend +- Blue/green hot-swap deployments of subgraphs, allowing for seamless updates on your frontend - Project alert notification of outages and indexing issues - A team who monitors your Subgraphs 24/7, with potential for service level agreements real time support with your team @@ -25,6 +25,7 @@ SubQuery provides a superior developer experience to The Graph, while maintainin - **More control** - A large library of [command line parameters](../run_publish/references.md) to all you to run, monitor, and optimise your locally hosted project - **Managed Service hosting** - We have no plans to sunset our [Managed Service](https://managedservice.subquery.network), which provides enterprise-level infrastructure hosting and handles over hundreds of millions of requests each day - **A decentralised network supporting all chains** - Our [decentralised network](https://app.subquery.network) supports all chains that SubQuery support, there is no _second-class_ chain support in the SubQuery ecosystem +- **The same query API** - We support a Subgraph compatible query service, providing the same GraphQL API that you are currently using. ![Competitor Comparison](/assets/img/build/graph_comparison.jpg) @@ -82,7 +83,7 @@ Once this is done, follow along and complete the remaining steps: - Store operations are asynchronous, e.g. `.load(id)` should be replaced by `await .get(id)` and `.save()` to `await .save()` (note the `await`). - With strict mode, you must construct new entities with all the required properties. You may want to replace `new (id)` with `.create({ ... })` - [More info](#mapping). -5. Test and update your clients to follow the GraphQL api differences and take advantage of additional features. [More info](#graphql-query-differences) +5. Either use the [Subgraph compatibale query service](../run_publish/query/subgraph.md), or test and update your clients to follow the SubQuery native GraphQL API. There are some minor and you can take advantage of additional features. [More info](#graphql-query-differences) ### Differences in the GraphQL Schema @@ -388,7 +389,13 @@ The above example assumes that the user has an ABI file named `erc20.json`, so t ### Differences in the GraphQL Query Interface -There are minor differences between the default GraphQL query service for SubQuery, and that of the Graph. +::: info Query Service Variants + +SubQuery provides two query service variants, a SubQuery native query service (`@subql/query`) and a version that is compatible with the standard query service used by Subgraphs (`@subql/query-subgraph`). We **recommend** the SubQuery native query service but for ease of migration you may want to use the [version that is the same as the Subgraph query service](../run_publish/query/subgraph.md). + +::: + +There are minor differences between the native SubQuery GraphQL query service for SubQuery, and that of the Graph. Remember there is a [version that is the same as the Subgraph query service](../run_publish/query/subgraph.md). #### Query format @@ -518,6 +525,38 @@ There is no difference when querying [historical data](../run_publish/historical ::: +#### Offset and Skip + +SubQuery uses the `offset` field to skip a number of elements, while Subgraphs use the `skip` field. + +::: code-tabs + +@tab SubGraph + +```graphql +{ + exampleEntities(first: 1, skip: 10) { + field1 + field2 + } +} +``` + +@tab:active SubQuery + +```graphql +{ + exampleEntities(first: 1, offset: 10) { + nodes { + field1 + field2 + } + } +} +``` + +::: + #### Metadata SubQuery does not support historical metadata querying. However `deployments` will still show the deployments with their heights and other key metrics diff --git a/docs/indexer/build/manifest/algorand.md b/docs/indexer/build/manifest/algorand.md index 44616b48cc0..881d20d2cd5 100644 --- a/docs/indexer/build/manifest/algorand.md +++ b/docs/indexer/build/manifest/algorand.md @@ -204,8 +204,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | We currently support `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/arbitrum.md b/docs/indexer/build/manifest/arbitrum.md index 9fc9601ba77..00a8cb84e9f 100644 --- a/docs/indexer/build/manifest/arbitrum.md +++ b/docs/indexer/build/manifest/arbitrum.md @@ -235,8 +235,8 @@ There is only a dictionary for Arbitrum One `https://gx.api.subquery.network/sq/ | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/avalanche.md b/docs/indexer/build/manifest/avalanche.md index 0bb2955a867..e910e531f0e 100644 --- a/docs/indexer/build/manifest/avalanche.md +++ b/docs/indexer/build/manifest/avalanche.md @@ -244,8 +244,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/bsc.md b/docs/indexer/build/manifest/bsc.md index 7a606906c0e..c079aede42f 100644 --- a/docs/indexer/build/manifest/bsc.md +++ b/docs/indexer/build/manifest/bsc.md @@ -233,8 +233,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/concordium.md b/docs/indexer/build/manifest/concordium.md index e460565fdab..f08e1f4825b 100644 --- a/docs/indexer/build/manifest/concordium.md +++ b/docs/indexer/build/manifest/concordium.md @@ -164,8 +164,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | We currently support `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/cosmos.md b/docs/indexer/build/manifest/cosmos.md index 5d7a9c1cfc0..918e5c30bd0 100644 --- a/docs/indexer/build/manifest/cosmos.md +++ b/docs/indexer/build/manifest/cosmos.md @@ -217,8 +217,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | We currently support `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/ethereum.md b/docs/indexer/build/manifest/ethereum.md index facaea9c1f3..00d41280cb4 100644 --- a/docs/indexer/build/manifest/ethereum.md +++ b/docs/indexer/build/manifest/ethereum.md @@ -231,8 +231,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/flare.md b/docs/indexer/build/manifest/flare.md index d5f61eb34dd..ca449da8ffd 100644 --- a/docs/indexer/build/manifest/flare.md +++ b/docs/indexer/build/manifest/flare.md @@ -228,8 +228,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/gnosis.md b/docs/indexer/build/manifest/gnosis.md index 99808e4af41..19d299bacca 100644 --- a/docs/indexer/build/manifest/gnosis.md +++ b/docs/indexer/build/manifest/gnosis.md @@ -244,8 +244,8 @@ There is a dictionary for Gnosis which is `https://api.subquery.network/sq/subqu | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/near.md b/docs/indexer/build/manifest/near.md index d928fa8af5e..dd58d116eb4 100644 --- a/docs/indexer/build/manifest/near.md +++ b/docs/indexer/build/manifest/near.md @@ -246,8 +246,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | We currently support `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/optimism.md b/docs/indexer/build/manifest/optimism.md index 2f7575ceb67..7425434eadd 100644 --- a/docs/indexer/build/manifest/optimism.md +++ b/docs/indexer/build/manifest/optimism.md @@ -243,8 +243,8 @@ There is a dictionary for Optimism which is `https://api.subquery.network/sq/sub | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/polkadot.md b/docs/indexer/build/manifest/polkadot.md index 53a8c202654..4dd99f1f3ab 100644 --- a/docs/indexer/build/manifest/polkadot.md +++ b/docs/indexer/build/manifest/polkadot.md @@ -201,7 +201,7 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | All manifest versions | Description | | ----------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **name** | String | We currently support `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/polygon.md b/docs/indexer/build/manifest/polygon.md index 677f972cabe..11bcbd931a0 100644 --- a/docs/indexer/build/manifest/polygon.md +++ b/docs/indexer/build/manifest/polygon.md @@ -232,10 +232,10 @@ Public nodes may be rate limited which can affect indexing speed, when developin ### Runner Query Spec -| Field | Type | Description | -| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| Field | Type | Description | +| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/build/manifest/stellar.md b/docs/indexer/build/manifest/stellar.md index b9f19ab97c1..a292ed01a64 100644 --- a/docs/indexer/build/manifest/stellar.md +++ b/docs/indexer/build/manifest/stellar.md @@ -233,8 +233,8 @@ Public nodes may be rate limited which can affect indexing speed, when developin | Field | Type | Description | | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **name** | String | `@subql/query` | -| **version** | String | Version of the Query service, available versions can be found [here](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | +| **name** | String | `@subql/query` and `@subql/query-subgraph` | +| **version** | String | Version of the Query service, available `@subql/query` [versions](https://github.com/subquery/subql/blob/main/packages/query/CHANGELOG.md) and `@subql/query-subgraph` [versions](https://github.com/subquery/query-subgraph/blob/main/CHANGELOG.md), it also must follow the SEMVER rules or `latest`. | ### Runner Node Options diff --git a/docs/indexer/run_publish/query/aggregate.md b/docs/indexer/run_publish/query/aggregate.md index 40a800fc85c..7eb58fb7f06 100644 --- a/docs/indexer/run_publish/query/aggregate.md +++ b/docs/indexer/run_publish/query/aggregate.md @@ -1,5 +1,11 @@ # Aggregate Functions +:::warning Not supported in Subgraph Query Service + +This feature is only supported in the SubQuery Native query service, not the Subgraph query service. + +::: + ## Group By SubQuery supports advanced aggregate functions to allow you to perform a calculation on a set of values during your query. diff --git a/docs/indexer/run_publish/query/graphql.md b/docs/indexer/run_publish/query/graphql.md index 07a815c7e0f..90f23024ab5 100644 --- a/docs/indexer/run_publish/query/graphql.md +++ b/docs/indexer/run_publish/query/graphql.md @@ -1,8 +1,10 @@ -# Query your Project using GraphQL +# SubQuery Native Query Service ::: info Coming from the Graph? -You may want to take a look at the information we have [on the differences](../../build/graph-migration.md#graphql-query-differences) between SubQuery's GraphQL library, and The Graph. +Instead, you may consider to use the [Subgraph style query service we have!](./subgraph.md) + +Or, you may want to take a look at the information we have [on the differences](../../build/graph-migration.md#graphql-query-differences) between SubQuery's GraphQL library, and The Graph. ::: diff --git a/docs/indexer/run_publish/query/query.md b/docs/indexer/run_publish/query/query.md index f8f111f80a1..a8f4b98059d 100644 --- a/docs/indexer/run_publish/query/query.md +++ b/docs/indexer/run_publish/query/query.md @@ -2,7 +2,13 @@ The default way that most query SubQuery Indexing SDK projects is by the excellent [GraphQL Query service](./graphql.md). -Native builds of SubQuery running in [Docker](../run.md#using-docker) will automatically include query service (`subql/query`). If you run it locally, you will also [likely run a query service](../run.md#running-the-query-service) instance. +::: info Query Service Variants + +SubQuery provides two query service variants, a SubQuery native query service (`@subql/query`) and a version that is compatible with the standard query service used by Subgraphs (`@subql/query-subgraph`). We **recommend** the SubQuery native query service + +::: + +Native builds of SubQuery running in [Docker](../run.md#using-docker) will automatically include SubQuery native query service (`@subql/query`). If you run it locally, you will also [likely run a query service](../run.md#running-the-query-service) instance. Both the decentralised SubQuery Network and the SubQuery Managed Service only provide access to SubQuery SDK indexing projects via the GraphQL endpoints exposed by the query service. @@ -14,11 +20,12 @@ SubQuery is open-source, and we are busy creating a rich ecosystem of developer We now have guides to expose SubQuery data to the following locations. -- [GraphQL](./graphql.md) - the default query pattern. +- [SubQuery Native GraphQL](./graphql.md) - the default query pattern. +- [Subgraph Style GraphQL](./subgraph.md) - version that is compatible with the standard query service used by Subgraphs - [GraphQL Subscriptions](./subscription.md) - subscribe to updated data as soon as it is indexed. - [Direct Postgres Access](../run.md#connect-to-database) - you can directly connect to the Postgres data from any other tool or service. - [Metabase](./other_tools/metabase.md) - an industry leading open-source and free data visualisation and business intelligence tool. - [CSV Export](../references.md#csv-out-dir) - export indexed datasets to CSV files easily. -- [BigQuery](./other_tools/bigquery.md) - a fully managed, server-less data warehouse provided by Google Cloud, well-suited for analyzing large volumes of data. +- [BigQuery](./other_tools/bigquery.md) - a fully managed, server-less data warehouse provided by Google Cloud, well-suited for analysing large volumes of data. ![Integration Ecosystem](/assets/img/run_publish/integration_ecosystem.png) diff --git a/docs/indexer/run_publish/query/subgraph.md b/docs/indexer/run_publish/query/subgraph.md new file mode 100644 index 00000000000..37aeb8346e8 --- /dev/null +++ b/docs/indexer/run_publish/query/subgraph.md @@ -0,0 +1,65 @@ +# SubGraph Style Query Service + +We support a query service that is compatible with the Subgraph query style `GraphQL` queries, which are a bit different from the native SubQuery query service. + +Below is an introduction to how to install and use it in your project. + +## Running using Docker + +The [standard SubQuery hosting approach](../run.md#using-docker) is to use a Docker container, defined by the `docker-compose.yml` file. For a newly initialised project, you need to make the following changes here. + +Modify `docker-compose.yml` to update the graphql-engine image to `subquerynetwork/query-subgraph`. + +``` + graphql-engine: + ### Usage subquerynetwork/query-subgraph image + image: subquerynetwork/query-subgraph:latest + ports: + - 3000:3000 + depends_on: + "postgres": + condition: service_healthy + "subquery-node": + condition: service_healthy + restart: always + environment: + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + command: + - --name=app +``` + +Under the project directory run the following command: + +```shell +docker-compose pull && docker-compose up +``` + +::: tip Note It may take some time to download the required packages ([`@subql/node`](https://www.npmjs.com/package/@subql/node), [`@subql/query-subgraph`](https://www.npmjs.com/package/@subql/query-subgraph), and Postgres) for the first time but soon you'll see a running SubQuery node. +::: + +## Running Locally + +If [running locally using Node](../run.md#running-subquery-locally), replace `@subql/query` with `@subql/query-subgraph` + +Once installed, you can check the version by running: + +```shell +> subql-query-subgraph --version +0.1.0 +``` + +## Differences with SubQuery Native Query Service + +We recommend using the [SubQuery Native query service](./graphql.md) for the best experience. + +Find out more about [differences in the GraphQL Query Interface](../build/graph-migration.md#differences-in-the-graphql-query-interface). + +## Unsupported features + +- JSON field filtering is not supported. +- Cursor-based queries are not supported. +- Subscriptions are not supported. diff --git a/docs/indexer/run_publish/query/subscription.md b/docs/indexer/run_publish/query/subscription.md index a414eac7728..91cf8fba7ba 100644 --- a/docs/indexer/run_publish/query/subscription.md +++ b/docs/indexer/run_publish/query/subscription.md @@ -1,5 +1,11 @@ # GraphQL Subscriptions +:::warning Not supported in Subgraph Query Service + +This feature is only supported in the SubQuery Native query service, not the Subgraph query service. + +::: + ## What is a GraphQL Subscription SubQuery now also supports Graphql Subscriptions. Like queries, subscriptions enable you to fetch data. Unlike queries, subscriptions are long-lasting operations that can change their result over time. diff --git a/docs/indexer/run_publish/run.md b/docs/indexer/run_publish/run.md index 27c6beab5f5..a2b248c258d 100644 --- a/docs/indexer/run_publish/run.md +++ b/docs/indexer/run_publish/run.md @@ -209,7 +209,7 @@ export DB_PORT=5432 subql-node -f your-project-path ``` -Depending on the configuration of your Postgres database (e.g. a different database password), please ensure also that both the indexer (`subql/node`) and the query service (`subql/query`) can establish a connection to it. +Depending on the configuration of your Postgres database (e.g. a different database password), please ensure also that both the indexer (`subql/node`) and the query service (`@subql/query`) can establish a connection to it. If your database is using SSL, you can use the following command to add the server certificate to it: