Skip to content

Commit 8db6def

Browse files
authored
Updated Jira Docs. (dlt-hub#535)
1 parent d56b2df commit 8db6def

File tree

1 file changed

+144
-122
lines changed
  • docs/website/docs/dlt-ecosystem/verified-sources

1 file changed

+144
-122
lines changed
Lines changed: 144 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,212 @@
11
# Jira
22

3-
:::info
4-
Need help deploying these sources, or figuring out how to run them in your data stack?
3+
:::info Need help deploying these sources, or figuring out how to run them in your data stack?
54

6-
[Join our slack community](https://dlthub-community.slack.com/join/shared_invite/zt-1slox199h-HAE7EQoXmstkP_bTqal65g) or [book a call](https://calendar.app.google/kiLhuMsWKpZUpfho6) with our support engineer Adrian.
5+
[Join our Slack community](https://dlthub-community.slack.com/join/shared_invite/zt-1slox199h-HAE7EQoXmstkP_bTqal65g)
6+
or [book a call](https://calendar.app.google/kiLhuMsWKpZUpfho6) with our support engineer Adrian.
77
:::
88

9-
Jira, developed by Atlassian, is project management and issue-tracking software designed to assist teams in effectively organizing and tracking their projects and tasks. It provides a centralized platform for collaboration, prioritization, and organization of work.
9+
[Jira](https://www.atlassian.com/software/jira) by Atlassian helps teams manage projects and tasks
10+
efficiently, prioritize work, and collaborate.
1011

11-
With the help of this `dlt` Jira Verified Source and pipeline example, you can load data from various endpoints of the Jira API to your desired destination. This enables you to efficiently transfer and utilize Jira data in a way that suits your specific needs.
12+
This Jira `dlt` verified source and
13+
[pipeline example](https://github.com/dlt-hub/verified-sources/blob/master/sources/jira_pipeline.py)
14+
loads data using Jira API to the destination of your choice.
1215

13-
This verified source has the following default endpoint:
16+
The endpoints that this verified source supports are:
1417

15-
| Endpoint | Description |
16-
| --- | --- |
17-
| issues | individual pieces of work that must be completed |
18-
| users | administrator of a given project |
18+
| Name | Description |
19+
| --------- | ---------------------------------------------------------------------------------------- |
20+
| issues | individual pieces of work to be completed |
21+
| users | administrator of a given project |
1922
| workflows | the key aspect of managing and tracking the progress of issues or tasks within a project |
20-
| projects | a collection of tasks that need to be completed to achieve a certain outcome |
23+
| projects | a collection of tasks that need to be completed to achieve a certain outcome |
2124

22-
## Grab Credentials
25+
To get a complete list of sub-endpoints that can be loaded, see
26+
[jira/settings.py.](https://github.com/dlt-hub/verified-sources/blob/master/sources/jira/settings.py)
27+
28+
## Setup Guide
29+
30+
### Grab credentials
2331

2432
1. Log in to your Jira account.
25-
2. Navigate to the Jira project you have created.
26-
3. Click on your profile picture located in the top right corner, and choose "Manage Account."
27-
4. Go to the "Security" tab and select "Create and manage API tokens."
28-
5. Click on "Create API Token," provide a descriptive name, and click the "Create" button.
29-
6. Safely copy the newly generated access token.
3033

31-
## Initialize the Jira verified source and the pipeline example
34+
1. Navigate to the Jira project you have created.
3235

33-
To get started with this verified source, follow these steps:
36+
1. Click on your profile picture in the top right corner, and choose "Manage Account."
3437

35-
1. Open up your terminal or command prompt and navigate to the directory where you'd like to create your project.
36-
2. Enter the following command:
38+
1. Go to the "Security" tab and select "Create and manage API tokens."
3739

38-
```bash
39-
dlt init jira duckdb
40-
```
40+
1. Click "Create API Token," provide a descriptive name, and click the "Create" button.
4141

42-
This command will initialize your verified source with Jira and create a pipeline example with duckdb as the destination. If you'd like to use a different destination, simply replace `duckdb` with the name of your preferred destination. You can find supported destinations and their configuration options in our [documentation](https://dlthub.com/docs/dlt-ecosystem/destinations).
43-
44-
3. After running this command, a new directory will be created with the necessary files and configuration settings to get started.
45-
46-
```toml
47-
jira_source
48-
├── .dlt
49-
│ ├── config.toml
50-
│ └── secrets.toml
51-
├── jira
52-
│ └── __init__.py
53-
│ └── settings.py
54-
├── .gitignore
55-
├── requirements.txt
56-
└── jira_pipeline.py
57-
```
42+
1. Safely copy the newly generated access token.
5843

44+
### Initialize the verified source
5945

60-
## **Add credentials**
46+
To get started with your data pipeline, follow these steps:
6147

62-
1. Inside the `.dlt` folder, you'll find a file called `secrets.toml`, which is where you can securely store your access tokens and other sensitive information. It's important to handle this file with care and keep it safe.
48+
1. Enter the following command:
6349

64-
Here's what the file looks like:
50+
```bash
51+
dlt init jira duckdb
52+
```
6553

66-
```toml
67-
# put your secret values and credentials here. do not share this file and do not push it to github
68-
[sources.jira]
69-
subdomain = "set me up!" # please set me up!
70-
email = "set me up!" # please set me up!
71-
api_token = "set me up!" # please set me up!
72-
```
54+
[This command](../../reference/command-line-interface) will initialize
55+
[the pipeline example](https://github.com/dlt-hub/verified-sources/blob/master/sources/jira_pipeline.py)
56+
with Jira as the [source](../../general-usage/source) and [duckdb](../destinations/duckdb.md) as
57+
the [destination](../destinations).
7358

74-
2. A subdomain refers to the unique identifier that is part of the URL used to access your Jira account. For example, if your Jira account URL is "https://example.atlassian.net", then "example" is the subdomain.
75-
3. The email will be the email address associated with your Jira account used for login purposes.
76-
4. Replace the API token with the ones that you [copied above](jira.md#grab-credentials). This will ensure that this source can access your Jira resources securely.
77-
5. Finally, follow the instructions in **[Destinations](https://dlthub.com/docs/dlt-ecosystem/destinations)** to add credentials for your chosen destination. This will ensure that your data is properly routed to its final destination.
59+
1. If you'd like to use a different destination, simply replace `duckdb` with the name of your
60+
preferred [destination](../destinations).
7861

79-
## Run the pipeline example
62+
1. After running this command, a new directory will be created with the necessary files and
63+
configuration settings to get started.
8064

81-
1. Install the necessary dependencies by running the following command:
65+
For more information, read the
66+
[Walkthrough: Add a verified source.](../../walkthroughs/add-a-verified-source)
8267

83-
```bash
84-
pip install -r requirements.txt
85-
```
68+
### Add credentials
8669

87-
2. In “jira_pipeline.py”, if you do not have any custom queries, use the method "*load(endpoints=None)*" exclusively. However, if you have custom queries, modify the queries in the main method and utilize "*load_query_data(queries=queries)*". To execute the verified source, use the following command:
70+
1. Inside the `.dlt` folder, you'll find a file called `secrets.toml`, where you can securely store
71+
your access tokens and other sensitive information. It's important to handle this file with care
72+
and keep it safe.
8873

89-
```bash
90-
python3 jira_pipeline.py
91-
```
74+
Here's what the file looks like:
9275

93-
3. To make sure that everything is loaded as expected, use the command:
76+
```toml
77+
# put your secret values and credentials here. Please do not share this file, and do not push it to GitHub
78+
[sources.jira]
79+
subdomain = "set me up!" # please set me up!
80+
email = "set me up!" # please set me up!
81+
api_token = "set me up!" # please set me up!
82+
```
9483

95-
```bash
96-
dlt pipeline <pipeline_name> show
97-
```
84+
1. A subdomain in a URL identifies your Jira account. For example, in
85+
"https://example.atlassian.net", "example" is the subdomain.
9886

99-
For example, the pipeline_name for the above pipeline example is `jira_pipeline`, you may also use any custom name instead.
87+
1. Use the email address associated with your Jira account.
10088

101-
## Customizations
89+
1. Replace the "access_token" value with the [previously copied one](jira.md#grab-credentials) to
90+
ensure secure access to your Jira account.
10291

103-
To load data to the destination using this verified source, you have the option to write your own methods.
92+
1. Next, follow the [destination documentation](../../dlt-ecosystem/destinations) instructions to
93+
add credentials for your chosen destination, ensuring proper routing of your data to the final
94+
destination.
10495

105-
### Source and resource methods
96+
## Run the pipeline
10697

107-
`dlt` works on the principle of [sources](https://dlthub.com/docs/general-usage/source) and [resources](https://dlthub.com/docs/general-usage/resource) that for this verified source are found in the `__init__.py` file within the *jira* directory. This verified source has three default methods that form the basis of loading. The methods are:
98+
1. Before running the pipeline, ensure that you have installed all the necessary dependencies by
99+
running the command:
100+
```bash
101+
pip install -r requirements.txt
102+
```
103+
1. You're now ready to run the pipeline! To get started, run the following command:
104+
```bash
105+
python3 jira_pipeline.py
106+
```
107+
1. Once the pipeline has finished running, you can verify that everything loaded correctly by using
108+
the following command:
109+
```bash
110+
dlt pipeline <pipeline_name> show
111+
```
112+
For example, the `pipeline_name` for the above pipeline example is `jira_pipeline`, you may also
113+
use any custom name instead.
108114

109-
Source <u>jira</u>:
115+
For more information, read the [Walkthrough: Run a pipeline.](../../walkthroughs/run-a-pipeline)
116+
117+
## Sources and resources
118+
119+
`dlt` works on the principle of [sources](../../general-usage/source) and
120+
[resources](../../general-usage/resource).
121+
122+
### Default endpoints
123+
124+
You can write your own pipelines to load data to a destination using this verified source. However,
125+
it is important to note the complete list of the default endpoints given in
126+
[jira/settings.py.](https://github.com/dlt-hub/verified-sources/blob/master/sources/jira/settings.py)
127+
128+
### Source `jira`
129+
130+
This source function creates a list of resources to load data into the destination.
110131

111132
```python
112133
@dlt.source
113134
def jira(
114-
subdomain: str = dlt.secrets.value,
115-
email: str = dlt.secrets.value,
116-
api_token: str = dlt.secrets.value,
135+
subdomain: str = dlt.secrets.value,
136+
email: str = dlt.secrets.value,
137+
api_token: str = dlt.secrets.value,
117138
) -> Iterable[DltResource]:
118139
```
119140

120-
- **`subdomain`**: is a string parameter that represents the subdomain of the Jira account. It is defined in "*dlt.secrets.value*".
121-
- **`email`:** is a string parameter that represents the email associated with the Jira account. It is defined in *dlt.secrets.value*
122-
- **`api_token`:** is a string parameter that represents the API token for accessing the Jira account. It is defined in *dlt.secrets.value*
141+
- `subdomain`: The subdomain of the Jira account. Configured in ".dlt/secrets.toml".
142+
- `email`: The email associated with the Jira account. Configured in ".dlt/secrets.toml".
143+
- `api_token`: The API token for accessing the Jira account.Configured in ".dlt/secrets.toml".
123144

124-
The source function creates a list of resources and iterates over each resource, calling the "get_paginated_data()" function to retrieve paginated data from the corresponding Jira API endpoint.
145+
### Source `jira_search`
125146

126-
Source <u>jira_search</u>:
147+
This function returns a resource for querying issues using JQL
148+
[(Jira Query Language)](https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/).
127149

128150
```python
129151
@dlt.source
130152
def jira_search(
131-
subdomain: str = dlt.secrets.value,
132-
email: str = dlt.secrets.value,
133-
api_token: str = dlt.secrets.value,
153+
subdomain: str = dlt.secrets.value,
154+
email: str = dlt.secrets.value,
155+
api_token: str = dlt.secrets.value,
134156
) -> Iterable[DltResource]:
135157
```
136158

137-
This source function uses the “**subdomain**”, “**email**” and “**api_token**for authentication. This source function generates a resource function for searching issues by using [JQL(Jira Query Language)](https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/) queries. This is the resource function used for searching issues.
159+
The above function uses the same arguments `subdomain`, `email` and `api_token` as described above
160+
for [jira source](jira.md#source-jira).
161+
162+
### Resource `issues`
138163

139-
Resource <u>issues</u>:
164+
The resource function searches issues using JQL queries and then loads them to the destination.
140165

141166
```python
142167
@dlt.resource(write_disposition="replace")
143168
def issues(jql_queries: List[str]) -> Iterable[TDataItem]:
144169
api_path = "rest/api/3/search"
145170
```
146171

147-
The above resource function searches the issues using JQL queries. And returns issues to be loaded to the destination.
172+
`jql_queries`: Accepts a list of JQL queries.
148173

149174
## Create Your Data Loading Pipeline
150175

151-
If you wish to create your own pipelines you can leverage source and resource methods as discussed above.
176+
If you wish to create your own pipelines you can leverage source and resource methods as discussed
177+
above.
152178

153-
1. Configure the pipeline by specifying the pipeline name, destination, and dataset. To read more about pipeline configuration, please refer to our documentation [here](https://dlthub.com/docs/general-usage/pipeline).
179+
1. Configure the pipeline by specifying the pipeline name, destination, and dataset. To read more
180+
about pipeline configuration, please refer to our documentation
181+
[here](https://dlthub.com/docs/general-usage/pipeline):
154182

155-
```python
156-
pipeline = dlt.pipeline(
157-
pipeline_name="jira_pipeline", # Use a custom name if desired
158-
destination="duckdb", # Choose the appropriate destination (e.g., duckdb, redshift, post)
159-
dataset_name="jira" # Use a custom name if desired
160-
)
161-
```
162-
163-
2. To load custom endpoints such as “issues” and “users” using the `jira` source function:
164-
165-
```python
166-
#Run the pipeline
167-
load_info = pipeline.run(jira().with_resources("issues","users"))
168-
169-
# Print Load information
170-
print(f"Load Information: {load_info}")
171-
```
172-
173-
3. To load the custom issues using JQL queries, you can use your custom queries, here is an example below, you can use the following `jira_search` source function:
174-
175-
```python
176-
# Define the JQL queries as follows
177-
queries = [
178-
"created >= -30d order by created DESC",
179-
'created >= -30d AND project = DEV AND issuetype = Epic AND status = "In Progress" order by created DESC',
180-
]
183+
```python
184+
pipeline = dlt.pipeline(
185+
pipeline_name="jira_pipeline", # Use a custom name if desired
186+
destination="duckdb", # Choose the appropriate destination (e.g., duckdb, redshift, post)
187+
dataset_name="jira" # Use a custom name if desired
188+
)
189+
```
181190

182-
# Run the pipeline
183-
load_info = pipeline.run(jira_search().issues(jql_queries=queries))
184-
185-
# Print Load information
186-
print(f"Load Information: {load_info}")
187-
```
191+
2. To load custom endpoints such as “issues” and “users” using the jira source function:
188192

193+
```python
194+
#Run the pipeline
195+
load_info = pipeline.run(jira().with_resources("issues","users"))
196+
print(f"Load Information: {load_info}")
197+
```
189198

190-
That’s it! Enjoy running your `dlt` Jira pipeline!
199+
3. To load the custom issues using JQL queries, you can use custom queries, here is an example
200+
below:
201+
202+
```python
203+
# Define the JQL queries as follows
204+
queries = [
205+
"created >= -30d order by created DESC",
206+
"created >= -30d AND project = DEV AND issuetype = Epic AND status = "In Progress" order by created DESC",
207+
]
208+
# Run the pipeline
209+
load_info = pipeline.run(jira_search().issues(jql_queries=queries))
210+
# Print Load information
211+
print(f"Load Information: {load_info}")
212+
```

0 commit comments

Comments
 (0)