-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature to add a filtering options on the API call #145
base: main
Are you sure you want to change the base?
Conversation
tap_clickup/tap.py
Outdated
"workspace_id", th.IntegerType, required=False, description="Example: '20214542" # fetches the data for workspace_id | ||
), | ||
th.Property( | ||
"spaces_id", th.StringType, required=False, description="Example: '[45215477,4547547]" # fetches the data for workspace_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an ArrayType see https://sdk.meltano.com/en/latest/classes/typing/singer_sdk.typing.ArrayType.html
tap_clickup/streams.py
Outdated
# Need this stub as a hack on _sync to force it to use Partitions | ||
# Since this is a child stream we want each team_id to create a request for | ||
# archived:true and archived:false. And we want state to track properly | ||
partitions = [] | ||
|
||
basepath = "/team/{team_id}/task" | ||
space_ids_param = "&space_ids=" + "&space_ids=".join(map(str, space_ids)) if space_ids else "" #Dinamically create the spaces path to be passed on API call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Params should be handled via https://sdk.meltano.com/en/latest/classes/singer_sdk.RESTStream.html#singer_sdk.RESTStream.get_url_params
tap_clickup/streams.py
Outdated
@@ -16,7 +60,9 @@ class TeamsStream(ClickUpStream): | |||
primary_keys = ["id"] | |||
replication_key = None | |||
schema_filepath = SCHEMAS_DIR / "team.json" | |||
records_jsonpath = "$.teams[*]" | |||
# Necessary because if you have access to multiple workteams, the responses are replicated N times where N = # of worspaces you have access to | |||
records_jsonpath = f"$.teams[?(@.id == {workteamid})]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did they add a new concept of workteamid? Or workspace_id, could you link to that in clickups docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the structure is Workspace>Space>Folder>List>Task>Subtask
In the app/platform they are called workspaces, but for the API they are called Teams, also there is a feature called "teams" (that group users together) but in the API they call it "group"
https://clickup.com/api/clickupreference/operation/CreateTeam/
tap_clickup/streams.py
Outdated
@@ -4,6 +4,50 @@ | |||
import requests | |||
from singer_sdk.helpers.jsonpath import extract_jsonpath | |||
from tap_clickup.client import ClickUpStream | |||
import yaml #added to read information specifying spaces and workspaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this needs to go away. Please go through the getting started for Meltano, and read through how singer works.
Adding extra fields to a config
block added here https://github.com/AutoIDM/tap-clickup/blob/main/meltano.yml#L6 will pass all of the configs via the config CLI argument (via a json file) to the tap. This is all handled by the config options you altered in tap.py
below
tap_clickup/streams.py
Outdated
# Need this stub as a hack on _sync to force it to use Partitions | ||
# Since this is a child stream we want each team_id to create a request for | ||
# archived:true and archived:false. And we want state to track properly | ||
partitions = [] | ||
|
||
basepath = "/team/{team_id}/task" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this please
tap_clickup/tap.py
Outdated
"spaces_id", th.StringType, required=False, description="Example: '[45215477,4547547]" # fetches the data for workspace_id | ||
), | ||
th.Property( | ||
"list_ids", th.StringType, required=False, description="Example: '[454455478,784552187]" # fetches the data for workspace_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
tap_clickup/tap.py
Outdated
@@ -47,6 +47,15 @@ class TapClickUp(Tap): | |||
th.Property( | |||
"api_token", th.StringType, required=True, description="Example: 'pk_12345" | |||
), | |||
th.Property( | |||
"workspace_id", th.IntegerType, required=False, description="Example: '20214542" # fetches the data for workspace_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
tap_clickup/streams.py
Outdated
@@ -220,20 +267,26 @@ class TasksStream(ClickUpStream): | |||
|
|||
name = "task" | |||
# Date_updated_gt is greater than or equal to not just greater than | |||
path = "/team/{team_id}/task" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes from line 0 to line 50 need to go away
Addresses the requests to merge the PR AutoIDM#145
Description
When dealing with enterprise workspaces in ClickUp, as ClickUp admins, we often find ourselves having access to multiple workspaces, lists, tasks, and other elements that are not needed in our pipeline. To save resources, processing time, and improve efficiency, it is beneficial for us to have the ability to filter specific elements that we want to fetch.
Noteworthy ClickUp API Bugs
During the development of this project, I encountered some inherent bugs in ClickUp's API. Primarily, these bugs prevented the passing of a single space or list as a parameter. However, a workaround was discovered: by passing the same ID twice, the API would function correctly, and there are not any duplicate values in the API response.
Issues
For example, when using the command meltano --environment=dev run tap-clickup ..., the configurations are not being applied as expected from the dev envv because it reads only from the common configurations.
Taking this meltano.yml sample, the code always reads "spaces_id" as '90100424497' even when we run it in prod (which in this case should be '90070255202'