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 Pipedrive : Migrate Python CDK to Low-code CDK #29293

Closed

Conversation

avirajsingh7
Copy link
Contributor

What

Migrating Source pipedrive to Low-Code CDK
Closes #29135

How

Developed using (Configuration Based Source) low-code CDK

Recommended reading order

  1. manifest.yaml
  2. schemas/*

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user?
Yes, there are breaking changes due to Changes in spec.yaml file
At many places previous data type were wrong and added some new properties in schema as per response from API

Test

Acceptance Test Screenshot 2023-08-09 at 10 58 42 PM
Migrate Connector : Source Pipedrive
  • Community Member? Grant Edit Access to Maintainers instructions
  • Secrets in the Connector's Spec
  • 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::integrationTest.
  • Code Reviews Completed
    • Documentation Updated
    • Connector's README.md
    • Connector's bootstrap.md
    • docs/integrations//.md (including changelog. See changelog example)
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR Name follows PR Naming Conventions

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Before Merging a Connector Pull Request

Wow! What a great pull request you have here! πŸŽ‰

To merge this PR, ensure the following has been done/considered for each connector added or updated:

  • PR name follows PR naming conventions
  • Breaking changes are considered. If a Breaking Change is being introduced, ensure an Airbyte engineer has created a Breaking Change Plan.
  • Connector version has been incremented in the Dockerfile and metadata.yaml according to our Semantic Versioning for Connectors guidelines
  • You've updated the connector's metadata.yaml file any other relevant changes, including a breakingChanges entry for major version bumps. See metadata.yaml docs
  • Secrets in the connector's spec are annotated with airbyte_secret
  • All documentation files are up to date. (README.md, bootstrap.md, docs.md, etc...)
  • Changelog updated in docs/integrations/<source or destination>/<name>.md with an entry for the new version. See changelog example
  • Migration guide updated in docs/integrations/<source or destination>/<name>-migrations.md with an entry for the new version, if the version is a breaking change. See migration guide example
  • If set, you've ensured the icon is present in the platform-internal repo. (Docs)

If the checklist is complete, but the CI check is failing,

  1. Check for hidden checklists in your PR description

  2. Toggle the github label checklist-action-run on/off to re-run the checklist CI.

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label Aug 9, 2023
@marcosmarxm marcosmarxm added team/tse Technical Support Engineers Hackathon External low-code/ui connector builder hackathons hackathon-2023-08 labels Aug 9, 2023
Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

Some comments.

Comment on lines 2 to 3
"$schema": "http://json-schema.org/schema#",
"type": "object",
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why you remove this?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcosmarxm added

Comment on lines 156 to 157
paginator:
type: NoPagination
Copy link
Member

Choose a reason for hiding this comment

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

Why this is not using paginator?

Copy link
Contributor Author

@avirajsingh7 avirajsingh7 Aug 12, 2023

Choose a reason for hiding this comment

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

@marcosmarxm activity_types, currencies and permission_sets
does not have any clear pagination technique and nor they take any query parameter to get next page
So we have two ideas implementing NoPagination or removing this streams
whatever you suggest...

type: RecordSelector
extractor:
type: DpathExtractor
field_path: ["data", "*", "data","*"]
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using this path?
Uploading image.png…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

{
"success": true,
"data": [
{
"item": "user",
"id": 18047894,
"data": [
{
"id": 18047894,
"name": "Aviraj G",
"default_currency": "INR",
"timezone_name": "Asia/Kolkata",
"timezone_offset": "+05:30",
"locale": "en_US",
"email": "",
"phone": "
",
"created": "2023-08-07 05:15:57",
"modified": "2023-08-11 20:44:25",
"lang": 1,
"active_flag": true,
"is_admin": 1,
"last_login": "2023-08-11 20:44:25",
"signup_flow_variation": "",
"role_id": 1,
"has_created_company": false,
"icon_url": null,
"is_you": true
}
]
},
{
"item": "user",
"id": 18105578,
"data": [
{
"id": 18105578,
"name": "Av",
"default_currency": "INR",
"timezone_name": "Asia/Kolkata",
"timezone_offset": "+05:30",
"locale": "en_US",
"email": "***",
"phone": null,
"created": "2023-08-12 09:23:56",
"modified": "2023-08-12 09:24:55",
"lang": 1,
"active_flag": true,
"is_admin": 0,
"last_login": "2023-08-12 09:24:55",
"signup_flow_variation": "",
"role_id": 1,
"has_created_company": false,
"icon_url": null,
"is_you": false
}
]
}
],
"additional_data": {
"since_timestamp": "2017-01-25 00:00:00",
"last_timestamp_on_page": "2023-08-12 09:24:55",
"pagination": {
"start": 0,
"limit": 2,
"more_items_in_collection": false
}
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Api response for user that's why used this way

Copy link
Contributor Author

@avirajsingh7 avirajsingh7 Aug 12, 2023

Choose a reason for hiding this comment

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

else read is throwing error

Comment on lines 34 to 42
paginator:
type: "DefaultPaginator"
pagination_strategy:
type: "PageIncrement"
page_size: 50
page_token_option:
type: "RequestOption"
inject_into: "request_parameter"
field_name: "page"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if the simple DefaultPagination will work with Pipedrive pagination response.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@marcosmarxm ya true thanks for mentioning,
we can implement cursorpagination
only in lead stream we cant implement cursorpagination
can you suggest anything else for lead stream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

    paginator:
      type: "DefaultPaginator"
      pagination_strategy:
        type: "CursorPagination"
        cursor_value: "{{ response['additional_data']['pagination']['next_start'] }}"
      page_token_option:
        type: "RequestOption"
        inject_into: "request_parameter"
        field_name: "start"

Copy link
Member

@marcosmarxm marcosmarxm left a comment

Choose a reason for hiding this comment

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

Some comments.

Comment on lines -21 to -28
tests:
- config_path: "secrets/config.json"
expect_records:
path: "integration_tests/expected_records.jsonl"
ignored_fields:
users:
- name: modified
bypass_reason: "constantly increasing date-time field"
Copy link
Member

Choose a reason for hiding this comment

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

Please keep the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expected_records.jsonl this file was old that's why I removed it and it will lead to failures

Copy link
Member

Choose a reason for hiding this comment

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

@avirajsingh7 that files is used to compare records when running integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So for that I need to fix expected_records.jsonl file also according to latest schemas or I can keep old one?

- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
tests:
- config_path: "secrets/config.json"
backward_compatibility_tests_config:
disable_for_version: 0.1.19
disable_for_version: 1.0.0
Copy link
Member

Choose a reason for hiding this comment

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

There are not reason to change to breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to schema changes, I have done

Copy link
Member

Choose a reason for hiding this comment

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

It shouldn't be the case. For migrating a Beta/GA the schema should be broke right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I remove disable for version

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please remove those lines.

Comment on lines +8 to 10
backward_compatibility_tests_config:
disable_for_version: 1.0.0
connection:
Copy link
Member

Choose a reason for hiding this comment

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

Please keep the same config as before.

@marcosmarxm
Copy link
Member

Did you check my latest comments @avirajsingh7 ?

Comment on lines 2 to 3
"$schema": "http://json-schema.org/schema#",
"type": "object",
Copy link
Member

Choose a reason for hiding this comment

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

@avirajsingh7
Copy link
Contributor Author

@marcosmarxm added

@marcosmarxm
Copy link
Member

Thanks @avirajsingh7 the plans is to review your contribution next week. Meanwhile can you solve the conflicts your PR has?


ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=1.0.0
LABEL io.airbyte.version=2.0.0
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
LABEL io.airbyte.version=2.0.0
LABEL io.airbyte.version=1.1.0

- config_path: "integration_tests/invalid_config.json"
status: "failed"
discovery:
tests:
- config_path: "secrets/config.json"
backward_compatibility_tests_config:
disable_for_version: 0.1.19
disable_for_version: 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please remove those lines.

Comment on lines +38 to +42
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
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
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"
tests:
- config_path: "secrets/config.json"
configured_catalog_path: "integration_tests/configured_catalog.json"
future_state:
future_state_path: "integration_tests/abnormal_state.json"

connectorSubtype: api
connectorType: source
definitionId: d8286229-c680-4063-8c59-23b9b391c700
dockerImageTag: 1.0.0
dockerImageTag: 2.0.0
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
dockerImageTag: 2.0.0
dockerImageTag: 1.1.0

@@ -7,11 +7,13 @@

MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
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
"airbyte-cdk~=0.1",
"airbyte-cdk",

Comment on lines +12 to +16
TEST_REQUIREMENTS = [
"pytest~=6.2",
"pytest-mock~=3.6.1",
"connector-acceptance-test",
]
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
TEST_REQUIREMENTS = [
"pytest~=6.2",
"pytest-mock~=3.6.1",
"connector-acceptance-test",
]
TEST_REQUIREMENTS = [
"pytest~=6.2",
"pytest-mock~=3.6.1",
]

url_base: "https://api.pipedrive.com/v1"
http_method: "GET"
request_parameters:
api_token: "{{config['api_token']}}"
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
api_token: "{{config['api_token']}}"
api_token: "{{ config['authorization']['api_token'] }}"

This is to maintain compatibility with current config.

cursor_field: "update_time"
datetime_format: "%Y-%m-%d %H:%M:%S"
start_datetime:
datetime: "{{ config['replication_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
datetime: "{{ config['replication_start_date'] }}"
datetime: "{{ format_datetime(config['replication_start_date'], '%Y-%m-%d %H:%M:%S') }}"

Comment on lines +325 to +348
spec:
type: Spec
documentation_url: https://docs.airbyte.com/integrations/sources/pipedrive
connection_specification:
title: Pipedrive Spec
type: object
required:
- api_token
- replication_start_date
additionalProperties: true
properties:
api_token:
title: API Token
type: string
description: The Pipedrive API Token.
airbyte_secret: true
replication_start_date:
title: Start Date
description: UTC date and time in the format 2017-01-25T00:00:00Z. Any data
before this date will not be replicated. When specified and not None, then
stream will behave as incremental
examples:
- '2017-01-25 00:00:00Z'
type: string
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
spec:
type: Spec
documentation_url: https://docs.airbyte.com/integrations/sources/pipedrive
connection_specification:
title: Pipedrive Spec
type: object
required:
- api_token
- replication_start_date
additionalProperties: true
properties:
api_token:
title: API Token
type: string
description: The Pipedrive API Token.
airbyte_secret: true
replication_start_date:
title: Start Date
description: UTC date and time in the format 2017-01-25T00:00:00Z. Any data
before this date will not be replicated. When specified and not None, then
stream will behave as incremental
examples:
- '2017-01-25 00:00:00Z'
type: string
spec:
type: Spec
documentation_url: https://docs.airbyte.com/integrations/sources/pipedrive
connection_specification:
title: Pipedrive Spec
type: object
required:
- replication_start_date
additionalProperties: true
properties:
authorization:
type: object
title: API Key Authentication
required:
- api_token
properties:
api_token:
title: API Token
type: string
description: The Pipedrive API Token.
airbyte_secret: true
replication_start_date:
title: Start Date
description: UTC date and time in the format 2017-01-25T00:00:00Z. Any data
before this date will not be replicated. When specified and not None, then
stream will behave as incremental
examples:
- '2017-01-25 00:00:00Z'
type: string

@marcosmarxm
Copy link
Member

Hello, and thank you so much for contributing to the project during the Hackathon. Due to the high complexity of the code migration, we still have a few contributions open. I'm sending this message to update you that this contribution will be added to the final points we're going to announce tomorrow. With that said, we ask for your help to continue the process and finish the review.

@archangelic
Copy link
Contributor

I am currently working on this in #30553 and hope to get it merged today if possible!

@archangelic
Copy link
Contributor

Congrats! This was merged in #30553!

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 community connectors/source/pipedrive Hackathon External low-code/ui connector builder hackathons hackathon-2023-08 team/tse Technical Support Engineers
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

pipedrive
4 participants