|
1 | 1 | # tap-trello |
2 | | -A Singer tap for extracting data from the Trello API |
3 | 2 |
|
4 | | -This tap is currently under development. |
| 3 | +This is a [Singer](https://singer.io) tap that produces JSON-formatted data |
| 4 | +following the [Singer |
| 5 | +spec](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md). |
5 | 6 |
|
| 7 | +This tap: |
| 8 | + |
| 9 | +- Pulls raw data from the [Trello API]. |
| 10 | +- Extracts the following resources: |
| 11 | + - [BoardMemberships](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-memberships-get) |
| 12 | + |
| 13 | + - [BoardCustomFields](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-customfields-get) |
| 14 | + |
| 15 | + - [BoardLabels](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-labels-get) |
| 16 | + |
| 17 | + - [CardAttachments](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-get) |
| 18 | + |
| 19 | + - [CardCustomFieldItems](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-customfielditems-get) |
| 20 | + |
| 21 | + - [Members](https://developer.atlassian.com/cloud/trello/rest/api-group-members/#api-members-id-get) |
| 22 | + |
| 23 | + - [Organizations](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-get) |
| 24 | + |
| 25 | + - [OrganizationActions](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-actions-get) |
| 26 | + |
| 27 | + - [OrganizationMembers](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-members-get) |
| 28 | + |
| 29 | + - [OrganizationMemberships](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-memberships-get) |
| 30 | + |
| 31 | +- Outputs the schema for each resource |
| 32 | +- Incrementally pulls data based on the input state |
| 33 | + |
| 34 | + |
| 35 | +## Streams |
| 36 | + |
| 37 | + |
| 38 | +**[board_memberships](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-memberships-get)** |
| 39 | +- Primary keys: ['id'] |
| 40 | +- Replication strategy: FULL_TABLE |
| 41 | + |
| 42 | +**[board_custom_fields](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-customfields-get)** |
| 43 | +- Primary keys: ['id'] |
| 44 | +- Replication strategy: FULL_TABLE |
| 45 | + |
| 46 | +**[board_labels](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-labels-get)** |
| 47 | +- Primary keys: ['id'] |
| 48 | +- Replication strategy: FULL_TABLE |
| 49 | + |
| 50 | +**[card_attachments](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-get)** |
| 51 | +- Primary keys: ['id'] |
| 52 | +- Replication strategy: FULL_TABLE |
| 53 | + |
| 54 | +**[card_custom_field_items](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-customfielditems-get)** |
| 55 | +- Primary keys: ['id'] |
| 56 | +- Replication strategy: FULL_TABLE |
| 57 | + |
| 58 | +**[members](https://developer.atlassian.com/cloud/trello/rest/api-group-members/#api-members-id-get)** |
| 59 | +- Primary keys: ['id'] |
| 60 | +- Replication strategy: FULL_TABLE |
| 61 | + |
| 62 | +**[organizations](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-get)** |
| 63 | +- Primary keys: ['id'] |
| 64 | +- Replication strategy: FULL_TABLE |
| 65 | + |
| 66 | +**[organization_actions](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-actions-get)** |
| 67 | +- Primary keys: ['id'] |
| 68 | +- Replication strategy: INCREMENTAL |
| 69 | + |
| 70 | +**[organization_members](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-members-get)** |
| 71 | +- Primary keys: ['id'] |
| 72 | +- Replication strategy: FULL_TABLE |
| 73 | + |
| 74 | +**[organization_memberships](https://developer.atlassian.com/cloud/trello/rest/api-group-organizations/#api-organizations-id-memberships-get)** |
| 75 | +- Primary keys: ['id'] |
| 76 | +- Replication strategy: FULL_TABLE |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +## Authentication |
| 81 | + |
| 82 | +## Quick Start |
| 83 | + |
| 84 | +1. Install |
| 85 | + |
| 86 | + Clone this repository, and then install using setup.py. We recommend using a virtualenv: |
| 87 | + |
| 88 | + ```bash |
| 89 | + > virtualenv -p python3 venv |
| 90 | + > source venv/bin/activate |
| 91 | + > python setup.py install |
| 92 | + OR |
| 93 | + > cd .../tap-trello |
| 94 | + > pip install -e . |
| 95 | + ``` |
| 96 | +2. Dependent libraries. The following dependent libraries were installed. |
| 97 | + ```bash |
| 98 | + > pip install singer-python |
| 99 | + > pip install target-stitch |
| 100 | + > pip install target-json |
| 101 | +
|
| 102 | + ``` |
| 103 | + - [singer-tools](https://github.com/singer-io/singer-tools) |
| 104 | + - [target-stitch](https://github.com/singer-io/target-stitch) |
| 105 | + |
| 106 | +3. Create your tap's `config.json` file. The tap config file for this tap should include these entries: |
| 107 | + - `start_date` - the default value to use if no bookmark exists for an endpoint (rfc3339 date string) |
| 108 | + - `user_agent` (string, optional): Process and email for API logging purposes. Example: `tap-trello <api_user_email@your_company.com>` |
| 109 | + - `request_timeout` (integer, `300`): Max time for which request should wait to get a response. Default request_timeout is 300 seconds. |
| 110 | +
|
| 111 | + ```json |
| 112 | + { |
| 113 | + "start_date": "2019-01-01T00:00:00Z", |
| 114 | + "user_agent": "tap-trello <api_user_email@your_company.com>", |
| 115 | + "request_timeout": 300 |
| 116 | + } |
| 117 | + ``` |
| 118 | +
|
| 119 | + Optionally, also create a `state.json` file. `currently_syncing` is an optional attribute used for identifying the last object to be synced in case the job is interrupted mid-stream. The next run would begin where the last job left off. |
| 120 | +
|
| 121 | + ```json |
| 122 | + { |
| 123 | + "currently_syncing": "engage", |
| 124 | + "bookmarks": { |
| 125 | + "export": "2019-09-27T22:34:39.000000Z", |
| 126 | + "funnels": "2019-09-28T15:30:26.000000Z", |
| 127 | + "revenue": "2019-09-28T18:23:53Z" |
| 128 | + } |
| 129 | + } |
| 130 | + ``` |
| 131 | +
|
| 132 | +4. Run the Tap in Discovery Mode |
| 133 | + This creates a catalog.json for selecting objects/fields to integrate: |
| 134 | + ```bash |
| 135 | + tap-trello --config config.json --discover > catalog.json |
| 136 | + ``` |
| 137 | + See the Singer docs on discovery mode |
| 138 | + [here](https://github.com/singer-io/getting-started/blob/master/docs/DISCOVERY_MODE.md#discovery-mode). |
| 139 | +
|
| 140 | +5. Run the Tap in Sync Mode (with catalog) and [write out to state file](https://github.com/singer-io/getting-started/blob/master/docs/RUNNING_AND_DEVELOPING.md#running-a-singer-tap-with-a-singer-target) |
| 141 | +
|
| 142 | + For Sync mode: |
| 143 | + ```bash |
| 144 | + > tap-trello --config tap_config.json --catalog catalog.json > state.json |
| 145 | + > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json |
| 146 | + ``` |
| 147 | + To load to json files to verify outputs: |
| 148 | + ```bash |
| 149 | + > tap-trello --config tap_config.json --catalog catalog.json | target-json > state.json |
| 150 | + > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json |
| 151 | + ``` |
| 152 | + To pseudo-load to [Stitch Import API](https://github.com/singer-io/target-stitch) with dry run: |
| 153 | + ```bash |
| 154 | + > tap-trello --config tap_config.json --catalog catalog.json | target-stitch --config target_config.json --dry-run > state.json |
| 155 | + > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json |
| 156 | + ``` |
| 157 | +
|
| 158 | +6. Test the Tap |
| 159 | + While developing the trello tap, the following utilities were run in accordance with Singer.io best practices: |
| 160 | + Pylint to improve [code quality](https://github.com/singer-io/getting-started/blob/master/docs/BEST_PRACTICES.md#code-quality): |
| 161 | + ```bash |
| 162 | + > pylint tap_trello -d missing-docstring -d logging-format-interpolation -d too-many-locals -d too-many-arguments |
| 163 | + ``` |
| 164 | + Pylint test resulted in the following score: |
| 165 | + ```bash |
| 166 | + Your code has been rated at 9.67/10 |
| 167 | + ``` |
| 168 | +
|
| 169 | + To [check the tap](https://github.com/singer-io/singer-tools#singer-check-tap) and verify working: |
| 170 | + ```bash |
| 171 | + > tap_trello --config tap_config.json --catalog catalog.json | singer-check-tap > state.json |
| 172 | + > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json |
| 173 | + ``` |
| 174 | +
|
| 175 | + #### Unit Tests |
| 176 | +
|
| 177 | + Unit tests may be run with the following. |
| 178 | +
|
| 179 | + ``` |
| 180 | + python -m pytest --verbose |
| 181 | + ``` |
| 182 | +
|
| 183 | + Note, you may need to install test dependencies. |
| 184 | +
|
| 185 | + ``` |
| 186 | + pip install -e .'[dev]' |
| 187 | + ``` |
6 | 188 | --- |
7 | 189 |
|
8 | | -Copyright © 2020 Stitch |
| 190 | +Copyright © 2020–2025 Stitch |
0 commit comments