Skip to content

Commit

Permalink
subgraph query document (#555)
Browse files Browse the repository at this point in the history
* subgraph query document

* Update docs/indexer/build/subgraph-style.md

Co-authored-by: Scott Twiname <[email protected]>

* subgraph-query usage

* some change

* Review updates

---------

Co-authored-by: Scott Twiname <[email protected]>
Co-authored-by: James Bayly <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2024
1 parent 0ac12ea commit fc26a5e
Show file tree
Hide file tree
Showing 22 changed files with 165 additions and 39 deletions.
1 change: 1 addition & 0 deletions docs/.vuepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
],
},
{
Expand Down
47 changes: 43 additions & 4 deletions docs/indexer/build/graph-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -82,7 +83,7 @@ Once this is done, follow along and complete the remaining steps:
- Store operations are asynchronous, e.g. `<entityName>.load(id)` should be replaced by `await <entityName>.get(id)` and `<entityName>.save()` to `await <entityName>.save()` (note the `await`).
- With strict mode, you must construct new entities with all the required properties. You may want to replace `new <entityName>(id)` with `<entityName>.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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/algorand.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/arbitrum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/avalanche.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/bsc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/concordium.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/cosmos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/ethereum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/flare.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/indexer/build/manifest/gnosis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit fc26a5e

Please sign in to comment.