Skip to content

Commit

Permalink
🐛 Source Dixa: fix tests and conversation stream (airbytehq#27250)
Browse files Browse the repository at this point in the history
* fix tests and conversation stream

* fix eof conversation export stream

* fix unit test

* fix: semantic versioning correction for new stream

---------

Co-authored-by: sajarin <[email protected]>
  • Loading branch information
marcosmarxm and sajarin authored Jun 12, 2023
1 parent 6232650 commit 546adcb
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 15 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-dixa/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.version=0.2.0
LABEL io.airbyte.name=airbyte/source-dixa
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tests:
- config_path: "secrets/config.json"
status: "succeed"
- config_path: "integration_tests/invalid_config.json"
status: "exception"
status: "failed"
discovery:
- config_path: "secrets/config.json"
basic_read:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"api_token": "TOKEN",
"start_date": "2020-01-01",
"batch_size": "31"
"batch_size": 31
}
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-dixa/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 0b5c867e-1b12-4d02-ab74-97b2184ff6d7
dockerImageTag: 0.1.3
dockerImageTag: 0.2.0
dockerRepository: airbyte/source-dixa
githubIssueLabel: source-dixa
icon: dixa.svg
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-dixa/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import find_packages, setup

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
"airbyte-cdk",
]

TEST_REQUIREMENTS = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Conversation Export",
"additionalProperties": true,
"type": ["null", "object"],
"required": ["id", "created_at", "initial_channel", "requester_id"],
"properties": {
"id": {
"type": ["null", "integer"]
Expand Down Expand Up @@ -145,6 +147,13 @@
"type": ["null", "string"]
}
},
"tags_info": {
"type": ["null", "array"],
"items": {
"type": ["null", "object"],
"additionalProperties": true
}
},
"conversation_wrapup_notes": {
"type": ["null", "array"],
"items": {
Expand All @@ -163,6 +172,9 @@
"status": {
"type": ["null", "string"]
},
"transferee_number": {
"type": ["null", "string"]
},
"updated_at": {
"type": ["null", "integer"]
},
Expand All @@ -180,6 +192,30 @@
},
"anonymized_at": {
"type": ["null", "integer"]
},
"custom_fields": {
"type": ["null", "array"],
"items": {
"type": ["null", "object"],
"additionalProperties": true,
"properties": {
"attribute_id": {
"type": ["null", "string"]
},
"identifier": {
"type": ["null", "string"]
},
"value": {
"type": ["null", "array", "string"]
},
"data_type": {
"type": ["null", "string"]
},
"archived": {
"type": ["null", "boolean"]
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) ->
"""
Check connectivity using one day's worth of data.
"""
config["authenticator"] = TokenAuthenticator(token=config["api_token"])
stream = ConversationExport(config)
# using 1 day batch size for slices.
stream.batch_size = 1
# use the first slice from stream_slices list
stream_slice = stream.stream_slices()[0]
try:
config["authenticator"] = TokenAuthenticator(token=config["api_token"])
stream = ConversationExport(config)
# using 1 day batch size for slices.
stream.batch_size = 1
# use the first slice from stream_slices list
stream_slice = stream.stream_slices()[0]
list(stream.read_records(sync_mode=SyncMode.full_refresh, stream_slice=stream_slice))
return True, None
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "Dixa Spec",
"type": "object",
"required": ["api_token", "start_date"],
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"api_token": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def test_stream_slices_without_state(conversation_export):
conversation_export.end_timestamp = 1625259600000 # 2021-07-03 00:00:00 + 1 ms

expected_slices = [
{"updated_after": 1625097600000, "updated_before": 1625184000000},
{"updated_after": 1625184000000, "updated_before": 1625259600000},
{'updated_after': 1625097600000, 'updated_before': 1625184000000},
{'updated_after': 1625184000000, 'updated_before': 1625259600000},
]

actual_slices = conversation_export.stream_slices()
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/dixa.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ When using the connector, keep in mind that increasing the `batch_size` paramete

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :-------------------------------------------------------------------- |
| 0.2.0 | 2023-06-08 | [25103](https://github.com/airbytehq/airbyte/pull/25103) | Add fields to `conversation_export` stream |
| 0.1.3 | 2022-07-07 | [14437](https://github.com/airbytehq/airbyte/pull/14437) | 🎉 Source Dixa: bump version 0.1.3 |
| 0.1.2 | 2021-11-08 | [7499](https://github.com/airbytehq/airbyte/pull/7499) | Remove base-python dependencies |
| 0.1.1 | 2021-08-12 | [5367](https://github.com/airbytehq/airbyte/pull/5367) | Migrated to CI Sandbox, refactorred code structure for future support |
Expand Down

0 comments on commit 546adcb

Please sign in to comment.