Skip to content

Commit

Permalink
GraphQL quickstart (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
gloomweaver committed Jun 3, 2024
1 parent 9339974 commit 0f33674
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
21 changes: 21 additions & 0 deletions graphql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GraphQL Data Connector

Follow these steps to get started with GraphQL as a Data Connector.

**Step 1.** Edit the `spicepod.yaml` file in this directory and replace the params in the `graphql_quickstart` dataset with the connection parameters for your GraphQL instance, where `[local_table_name]` is your desired name for the federated table, `[graphql_endpoint]` is the url to your GraphQL endpoint, `[graphql_query]` is the query to execute, and `[json_path]` is the path to the data in the GraphQL response.

For authentication options see [GraphQL Data Connector docs](https://docs.spiceai.org/data-connectors/graphql#configuration)

Follow the [quickstart guide](https://docs.spiceai.org/getting-started) to get started with the Spice.ai runtime.

See the [datasets reference](https://docs.spiceai.org/reference/spicepod/datasets) for more dataset configuration options.

To securely store your GraphQL auth params, see [Secret Stores](https://docs.spiceai.org/secret-stores)

**Step 2.** Run the Spice runtime with `spice run` from this directory.

**Step 3.** Run `spice sql` in a new terminal to start an interactive SQL query session against the Spice runtime.

For more information on using `spice sql`, see the [CLI reference](https://docs.spiceai.org/cli/reference/sql).

**Step 4.** Execute the query `select * from [local_table_name];` to see GraphQL response accelerated locally.
14 changes: 14 additions & 0 deletions graphql/spicepod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v1beta1
kind: Spicepod
name: graphql_quickstart
datasets:
- from: graphql:[graphql_endpoint]
name: [local_table_name]
params:
json_path: [json_path]
query: |
[graphql_query]
acceleration:
enabled: true
refresh_mode: full
refresh_check_interval: 15s

0 comments on commit 0f33674

Please sign in to comment.