Skip to content

CDK: don't filter failed interpolated vars for request_options_provider.request_body_json #19297

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

Merged
merged 11 commits into from
Nov 11, 2022
3 changes: 3 additions & 0 deletions airbyte-cdk/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.8.2
Low-code: Fix filtering vars in `InterpolatedRequestInputProvider.eval_request_inputs`

## 0.8.1
Low-code: Don't update cursor for non-record messages and fix default loader for connector builder manifests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ def eval_request_inputs(
interpolated_value = self._interpolator.eval(self.config, **kwargs)

if isinstance(interpolated_value, dict):
non_null_tokens = {k: v for k, v in interpolated_value.items() if v}
non_null_tokens = {k: v for k, v in interpolated_value.items() if v is not None}
return non_null_tokens
return interpolated_value
2 changes: 1 addition & 1 deletion airbyte-cdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="airbyte-cdk",
version="0.8.1",
version="0.8.2",
description="A framework for writing Airbyte Connectors.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
("test_value_depends_on_stream_slice", {"read_from_slice": "{{ stream_slice['start_date'] }}"}, {"read_from_slice": "2020-01-01"}),
("test_value_depends_on_next_page_token", {"read_from_token": "{{ next_page_token['offset'] }}"}, {"read_from_token": 12345}),
("test_value_depends_on_config", {"read_from_config": "{{ config['option'] }}"}, {"read_from_config": "OPTION"}),
("test_none_value", {"missing_param": "{{ fake_path['date'] }}"}, {}),
("test_missing_value", {"missing_param": "{{ fake_path['date'] }}"}, {}),
(
"test_parameter_is_interpolated",
{"{{ stream_state['date'] }} - {{stream_slice['start_date']}} - {{next_page_token['offset']}} - {{config['option']}}": "ABC"},
{"2021-01-01 - 2020-01-01 - 12345 - OPTION": "ABC"},
),
("test_boolean_false_value", {"boolean_false": "{{ False }}"}, {"boolean_false": False}),
("test_integer_falsy_value", {"integer_falsy": "{{ 0 }}"}, {"integer_falsy": 0}),
("test_number_falsy_value", {"number_falsy": "{{ 0.0 }}"}, {"number_falsy": 0.0}),
("test_string_falsy_value", {"string_falsy": "{{ '' }}"}, {}),
("test_none_value", {"none_value": "{{ None }}"}, {}),
],
)
def test_interpolated_request_params(test_name, input_request_params, expected_request_params):
Expand All @@ -45,12 +50,17 @@ def test_interpolated_request_params(test_name, input_request_params, expected_r
("test_value_depends_on_stream_slice", {"read_from_slice": "{{ stream_slice['start_date'] }}"}, {"read_from_slice": "2020-01-01"}),
("test_value_depends_on_next_page_token", {"read_from_token": "{{ next_page_token['offset'] }}"}, {"read_from_token": 12345}),
("test_value_depends_on_config", {"read_from_config": "{{ config['option'] }}"}, {"read_from_config": "OPTION"}),
("test_none_value", {"missing_json": "{{ fake_path['date'] }}"}, {}),
("test_missing_value", {"missing_json": "{{ fake_path['date'] }}"}, {}),
(
"test_interpolated_keys",
{"{{ stream_state['date'] }}": 123, "{{ config['option'] }}": "ABC"},
{"2021-01-01": 123, "OPTION": "ABC"},
),
("test_boolean_false_value", {"boolean_false": "{{ False }}"}, {"boolean_false": False}),
("test_integer_falsy_value", {"integer_falsy": "{{ 0 }}"}, {"integer_falsy": 0}),
("test_number_falsy_value", {"number_falsy": "{{ 0.0 }}"}, {"number_falsy": 0.0}),
("test_string_falsy_value", {"string_falsy": "{{ '' }}"}, {}),
("test_none_value", {"none_value": "{{ None }}"}, {}),
],
)
def test_interpolated_request_json(test_name, input_request_json, expected_request_json):
Expand Down