Query Linear Issues with GraphQL
LlamaIndex reader that pulls Linear issues into documents via a GraphQL query.
Why it matters
Fetch and process issue data from Linear using GraphQL queries. This asset allows you to extract specific issue details based on your defined query, enabling data integration and analysis.
Outcomes
What it gets done
Connect to Linear API using an API key.
Execute custom GraphQL queries to retrieve issue data.
Extract issue details such as title, description, and assignee.
Load retrieved issue data into a structured format for further processing.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-linear | bash Overview
Linear Reader
The Linear Reader pulls Linear issues into LlamaIndex documents, shaped by a GraphQL query you write yourself -- targeting a team and requesting fields like title, description, assignee, and dates. Use it when you need Linear issue data loaded into LlamaIndex via a custom GraphQL query. It requires a Linear API key and writing the query yourself.
What it does
The Linear Reader returns issues from Linear based on a GraphQL query. You initialize LinearReader with an API key, then call load_data with a GraphQL query string (Linear's own query language) to fetch matching issues.
When to use - and when NOT to
Use it when you need Linear issues -- with fields like ID, title, description, assignee, creation date, and archive date -- pulled into LlamaIndex documents via a custom GraphQL query. It requires a Linear API key, so it is not usable without one, and it requires writing the GraphQL query yourself rather than offering simpler filter parameters.
Inputs and outputs
Install with:
pip install llama-index-readers-linear
Instantiate with an API key, then load issues with a GraphQL query targeting a specific team:
from llama_index.readers.linear import LinearReader
reader = LinearReader(api_key=api_key)
query = """
query Team {
team(id: "9cfb482a-81e3-4154-b5b9-2c805e70a02d") {
id
name
issues {
nodes {
id
title
description
assignee {
id
name
}
createdAt
archivedAt
}
}
}
}
"""
documents = reader.load_data(query=query)
The query above targets a specific team by ID and requests each issue's ID, title, description, assignee (ID and name), creation date, and archive date -- any valid Linear GraphQL query can be used to shape what is returned.
Who it's for
Developers building LlamaIndex pipelines that need Linear issue data, shaped by a custom GraphQL query, loaded as documents.
Source README
Linear Reader
pip install llama-index-readers-linear
The Linear loader returns issue based on the query.
Usage
Here's an example of how to use it
from llama_index.readers.linear import LinearReader
reader = LinearReader(api_key=api_key)
query = """
query Team {
team(id: "9cfb482a-81e3-4154-b5b9-2c805e70a02d") {
id
name
issues {
nodes {
id
title
description
assignee {
id
name
}
createdAt
archivedAt
}
}
}
}
"""
documents = reader.load_data(query=query)
Alternately, you can also use download_loader from llama_index
from llama_index.readers.linear import LinearReader
reader = LinearReader(api_key=api_key)
query = """
query Team {
team(id: "9cfb482a-81e3-4154-b5b9-2c805e70a02d") {
id
name
issues {
nodes {
id
title
description
assignee {
id
name
}
createdAt
archivedAt
}
}
}
}
"""
documents = reader.load_data(query=query)
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.