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

Salesforce make start_date optional and change format to YYYY-MM-DD #8191

Merged
merged 10 commits into from
Dec 3, 2021

Conversation

augan-rymkhan
Copy link
Contributor

@augan-rymkhan augan-rymkhan commented Nov 23, 2021

What

  1. Make the start_date optional
  2. Change the pattern for start date from YYYY-MM-DDTXX:XX:XXZ to YYYY-MM-DD (but it should still accept previous format for compatbility)
  3. add title and description to all properties in Salesforce's input spec

How

  1. In the current implementation start_date variable is used in the query and it is defined as:
    start_date = next_page_token or stream_date or self.start_date
    self.start_date is from the user input config
    The solution provided here: if start_date is not None, then add WHERE {self.cursor_field} >= {start_date} clause to the query, otherwise query will fetch all data without filtering by date (also there is a LIMIT clause).
  2. Added format_start_date method will transform the start_date from format 2021-07-25 into the format 2021-07-25T00:00:00Z For backward compatibility, it works also with start_date` which is entered in date time (YYYY-MM-DDTXX:XX:XXZ) format.
  3. Added title for all properties in spec.json file.

Recommended reading order

  1. x.java
  2. y.python

🚨 User Impact 🚨

Are there any breaking changes? If yes, please make sure to include it here and in any changelogs with the 🚨🚨 emoji
What is the end result perceived by the user?

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • Credentials added to Github CI. Instructions.
  • /test connector=connectors/<name> command is passing.
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the new connector version is published, connector version bumped in the seed directory as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here

Connector Generator

  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed.

@github-actions github-actions bot added the area/connectors Connector related issues label Nov 23, 2021
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 23, 2021 09:18 Inactive
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label Nov 23, 2021
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 23, 2021 09:26 Inactive
@augan-rymkhan augan-rymkhan linked an issue Nov 23, 2021 that may be closed by this pull request
@augan-rymkhan augan-rymkhan self-assigned this Nov 23, 2021
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 23, 2021 11:10 Inactive
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 23, 2021 11:32 Inactive
@staticmethod
def format_start_date(start_date):
"""Transform the format `2021-07-25` into the format `2021-07-25T00:00:00Z`"""
return pendulum.parse(start_date).strftime('%Y-%m-%dT%H:%M:%SZ')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if start_date is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitaliizazmic This case is fixed now.

@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 30, 2021 12:47 Inactive
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 30, 2021 13:08 Inactive
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets November 30, 2021 13:56 Inactive
@jrhizor jrhizor temporarily deployed to more-secrets November 30, 2021 15:13 Inactive
@augan-rymkhan
Copy link
Contributor Author

augan-rymkhan commented Nov 30, 2021

/test connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1521553946
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1521553946
Python tests coverage:

	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                                 Stmts   Miss  Cover
	 ------------------------------------------------------------------------
	 source_acceptance_test/__init__.py                       2      0   100%
	 source_acceptance_test/base.py                          10      4    60%
	 source_acceptance_test/config.py                        75      8    89%
	 source_acceptance_test/conftest.py                     108    108     0%
	 source_acceptance_test/plugin.py                        47     47     0%
	 source_acceptance_test/tests/__init__.py                 4      0   100%
	 source_acceptance_test/tests/test_core.py              200     94    53%
	 source_acceptance_test/tests/test_full_refresh.py       38     27    29%
	 source_acceptance_test/tests/test_incremental.py        69     38    45%
	 source_acceptance_test/utils/__init__.py                 6      0   100%
	 source_acceptance_test/utils/asserts.py                 37      2    95%
	 source_acceptance_test/utils/common.py                  41     24    41%
	 source_acceptance_test/utils/compare.py                 62     25    60%
	 source_acceptance_test/utils/connector_runner.py        82     49    40%
	 source_acceptance_test/utils/json_schema_helper.py     115     14    88%
	 ------------------------------------------------------------------------
	 TOTAL                                                  896    440    51%
	 ---------- coverage: platform linux, python 3.8.10-final-0 -----------
	 Name                                 Stmts   Miss  Cover
	 --------------------------------------------------------
	 source_salesforce/__init__.py            2      0   100%
	 source_salesforce/api.py               114     58    49%
	 source_salesforce/exceptions.py          1      0   100%
	 source_salesforce/rate_limiting.py      22      6    73%
	 source_salesforce/source.py             57     24    58%
	 source_salesforce/streams.py           209     41    80%
	 --------------------------------------------------------
	 TOTAL                                  405    129    68%

@jrhizor jrhizor temporarily deployed to more-secrets November 30, 2021 15:17 Inactive
"additionalProperties": false,
"properties": {
"client_id": {
"title": "Client Id",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Client Id",
"title": "Client ID",

"description": "Salesforce Refresh Token used for Airbyte to access your Salesforce account. If you don't know what this is, follow this <a href=\"https://medium.com/@bpmmendis94/obtain-access-refresh-tokens-from-salesforce-rest-api-a324fe4ccd9b\">guide</a> to retrieve it.",
"type": "string",
"airbyte_secret": true
},
"start_date": {
"description": "UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated. This field uses the \"updated\" field if available, otherwise the \"created\" fields if they are available for a stream.",
"title": "Start Date",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Start Date",
"title": "Replication Start Date",

"description": "Salesforce Refresh Token used for Airbyte to access your Salesforce account. If you don't know what this is, follow this <a href=\"https://medium.com/@bpmmendis94/obtain-access-refresh-tokens-from-salesforce-rest-api-a324fe4ccd9b\">guide</a> to retrieve it.",
"type": "string",
"airbyte_secret": true
},
"start_date": {
"description": "UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated. This field uses the \"updated\" field if available, otherwise the \"created\" fields if they are available for a stream.",
"title": "Start Date",
"description": "Date in the format 2017-01-25. Any data before this date will not be replicated. This field uses the \"updated\" field if available, otherwise the \"created\" fields if they are available for a stream.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a sentence like If not set, then by default all your data is replicated.

},
"is_sandbox": {
"title": "Is Sandbox?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Is Sandbox?",
"title": "Sandbox",

},
"is_sandbox": {
"title": "Is Sandbox?",
"description": "Whether or not the the app is in a Salesforce sandbox. If you do not know what this, assume it is false. We provide more info on this field in the <a href=\"https://docs.airbyte.io/integrations/destinations/salesforce#is_sandbox\">docs</a>.",
"type": "boolean",
"default": false
},
"api_type": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create an issue to deprecate this option? this is an implementation detail that we should remove eventually

Copy link
Contributor Author

@augan-rymkhan augan-rymkhan Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sherifnada It's created here

@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets December 1, 2021 04:52 Inactive
@augan-rymkhan
Copy link
Contributor Author

augan-rymkhan commented Dec 1, 2021

/test connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1524231383
❌ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1524231383
🐛 https://gradle.com/s/pogxwytvahyqa

@jrhizor jrhizor temporarily deployed to more-secrets December 1, 2021 04:56 Inactive
@augan-rymkhan
Copy link
Contributor Author

augan-rymkhan commented Dec 2, 2021

/publish connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1529099578
❌ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1529099578

@jrhizor jrhizor temporarily deployed to more-secrets December 2, 2021 04:55 Inactive
@augan-rymkhan
Copy link
Contributor Author

augan-rymkhan commented Dec 3, 2021

/publish connector=connectors/source-salesforce

🕑 connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1534278884
✅ connectors/source-salesforce https://github.com/airbytehq/airbyte/actions/runs/1534278884

@jrhizor jrhizor temporarily deployed to more-secrets December 3, 2021 07:53 Inactive
@augan-rymkhan augan-rymkhan temporarily deployed to more-secrets December 3, 2021 08:38 Inactive
@augan-rymkhan augan-rymkhan merged commit 4e44166 into master Dec 3, 2021
@augan-rymkhan augan-rymkhan deleted the arymkhan/salesforce-make-start-date-optional branch December 3, 2021 08:38
schlattk pushed a commit to schlattk/airbyte that referenced this pull request Jan 4, 2022
…airbytehq#8191)

* Make `start_date` optional

* start_date can take format `2021-07-25`

* added title to all spec input properties and changed version in Dockerfile

* added a new item into salesforce.md changelogs

* fixed case when start_date is None

* formatted code

* changed comments in unit test fixtures

* changed spec title fields

* updated source and spec yaml

Co-authored-by: Auganbay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Various UX improvements for Salesforce
7 participants