Skip to content
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

🐛 Source Salesforce: parse CSV with "unix" dialect #9757

Merged
merged 5 commits into from
Jan 25, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"sourceDefinitionId": "b117307c-14b6-41aa-9422-947e34922962",
"name": "Salesforce",
"dockerRepository": "airbyte/source-salesforce",
"dockerImageTag": "0.1.18",
"dockerImageTag": "0.1.19",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/salesforce",
"icon": "salesforce.svg"
}
Original file line number Diff line number Diff line change
@@ -634,7 +634,7 @@
- name: Salesforce
sourceDefinitionId: b117307c-14b6-41aa-9422-947e34922962
dockerRepository: airbyte/source-salesforce
dockerImageTag: 0.1.18
dockerImageTag: 0.1.19
documentationUrl: https://docs.airbyte.io/integrations/sources/salesforce
icon: salesforce.svg
sourceType: api
Original file line number Diff line number Diff line change
@@ -25,5 +25,5 @@ COPY source_salesforce ./source_salesforce
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.18
LABEL io.airbyte.version=0.1.19
LABEL io.airbyte.name=airbyte/source-salesforce
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
#

import csv
import io
import math
import time
from abc import ABC
@@ -244,12 +245,10 @@ def filter_null_bytes(self, s: str):
def download_data(self, url: str) -> Tuple[int, dict]:
job_data = self._send_http_request("GET", f"{url}/results")
decoded_content = self.filter_null_bytes(job_data.content.decode("utf-8"))
csv_data = csv.reader(decoded_content.splitlines(), delimiter=",")
for i, row in enumerate(csv_data):
if i == 0:
head = row
else:
yield i, dict(zip(head, row))
fp = io.StringIO(decoded_content, newline="")
csv_data = csv.DictReader(fp, dialect="unix")
for n, row in enumerate(csv_data, 1):
yield n, row

def abort_job(self, url: str):
data = {"state": "Aborted"}
1 change: 1 addition & 0 deletions docs/integrations/sources/salesforce.md
Original file line number Diff line number Diff line change
@@ -737,6 +737,7 @@ List of available streams:

| Version | Date | Pull Request | Subject |
|:--------|:-----------| :--- |:--------------------------------------------------------------------------|
| 0.1.19 | 2022-01-24 | [9757](https://github.com/airbytehq/airbyte/pull/9757) | Parse CSV with "unix" dialect |
| 0.1.18 | 2022-01-20 | [9478](https://github.com/airbytehq/airbyte/pull/9478) | Add available stream filtering by `queryable` flag |
| 0.1.17 | 2022-01-19 | [9302](https://github.com/airbytehq/airbyte/pull/9302) | Deprecate API Type parameter |
| 0.1.16 | 2022-01-18 | [9151](https://github.com/airbytehq/airbyte/pull/9151) | Fix pagination in REST API streams |