Skip to content

Commit

Permalink
🐛 Source Monday: fix pagination and schema bug (#8016)
Browse files Browse the repository at this point in the history
* fix bug

* fix schema

* bump version

* format

* run seed

Co-authored-by: Marcos Marx <marcosmarxm@gmail.com>
  • Loading branch information
tuanchris and marcosmarxm authored Nov 20, 2021
1 parent 8a957ca commit 141524d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
- name: Monday
sourceDefinitionId: 80a54ea2-9959-4040-aac1-eee42423ec9b
dockerRepository: airbyte/source-monday
dockerImageTag: 0.1.0
dockerImageTag: 0.1.1
documentationUrl: https://docs.airbyte.io/integrations/sources/monday
sourceType: api
- name: MongoDb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3671,7 +3671,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-monday:0.1.0"
- dockerImage: "airbyte/source-monday:0.1.1"
spec:
documentationUrl: "https://docsurl.com"
connectionSpecification:
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-monday/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_monday ./source_monday
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.version=0.1.1
LABEL io.airbyte.name=airbyte/source-monday
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "object",
"properties": {
"assets": {
"type": ["array", "object"],
"type": ["null", "array"],
"properties": {
"id": { "type": ["null", "integer"] }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def should_retry(self, response: requests.Response) -> bool:
# Monday API return code 200 with and errors key if complexity is too high.
# https://api.developer.monday.com/docs/complexity-queries
is_complex_query = response.json().get("errors")
if is_complex_query:
self.logger.error(response.text)
return response.status_code == 429 or 500 <= response.status_code < 600 or is_complex_query

@property
Expand All @@ -66,7 +68,6 @@ def request_params(
graphql_params.update(next_page_token)

graphql_query = ",".join([f"{k}:{v}" for k, v in graphql_params.items()])

# Monday uses a query string to pass in environments
params = {"query": f"query {{ {self.name.lower()} ({graphql_query}) {{ {self.load_schema()} }} }}"}
return params
Expand Down Expand Up @@ -99,6 +100,16 @@ class Teams(MondayStream):
API Documentation: https://api.developer.monday.com/docs/teams-queries
"""

def request_params(
self, stream_state: Mapping[str, Any], stream_slice: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None
) -> MutableMapping[str, Any]:
# Stream teams doesn't support pagination
params = {"query": f"query {{ {self.name.lower()} () {{ {self.load_schema()} }} }}"}
return params

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
return {}


class Updates(MondayStream):
"""
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/monday.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ You can get the API key for Monday by going to Profile picture (bottom left) =>

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.1.1 | 2021-11-18 | [8016](https://github.com/airbytehq/airbyte/pull/8016) | 🐛 Source Monday: fix pagination and schema bug |
| 0.1.0 | 2021-11-07 | [7168](https://github.com/airbytehq/airbyte/pull/7168) | 🎉 New Source: Monday |

0 comments on commit 141524d

Please sign in to comment.