Skip to content

Commit

Permalink
Revert: #17047 Airbyte CDK: Improve error for returning non-iterable …
Browse files Browse the repository at this point in the history
…from connectors parse_response (#17707)

* Bump cdk version

* Revert "#17047 Airbyte CDK: Improve error for returning non-iterable from connectors parse_response (#17626)"

This reverts commit d9ad272.

* Bump
  • Loading branch information
girarda committed Oct 7, 2022
1 parent d9ad272 commit 18da341
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 24 deletions.
8 changes: 8 additions & 0 deletions airbyte-cdk/python/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog

## 0.1.97

- Revert 0.1.96

## 0.1.96

- Improve error for returning non-iterable from connectors parse_response

## 0.1.95

- Low-code: Expose PageIncrement strategy as component type
Expand Down
12 changes: 1 addition & 11 deletions airbyte-cdk/python/airbyte_cdk/models/airbyte_protocol.py
Expand Up @@ -10,7 +10,7 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import AnyUrl, BaseModel, Extra, Field, validator
from pydantic import AnyUrl, BaseModel, Extra, Field


class Type(Enum):
Expand All @@ -35,16 +35,6 @@ class Config:
description="when the data was emitted from the source. epoch in millisecond.",
)

@validator("data", pre=True)
def data_is_dict(cls: AirbyteRecordMessage, value: Dict[str, Any]):
if isinstance(value, dict):
return value
raise ValueError("Data object is not a dictionary. "
"This can happen when the parse_response method directly returns the response.json, "
"instead of yielding a it/elements of it."
f"Object instead is {type(value)} with value: {value}"
)


class AirbyteStateType(Enum):
GLOBAL = "GLOBAL"
Expand Down
2 changes: 1 addition & 1 deletion airbyte-cdk/python/setup.py
Expand Up @@ -15,7 +15,7 @@

setup(
name="airbyte-cdk",
version="0.1.95",
version="0.1.97",
description="A framework for writing Airbyte Connectors.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
12 changes: 0 additions & 12 deletions airbyte-cdk/python/unit_tests/sources/test_abstract_source.py
Expand Up @@ -800,15 +800,3 @@ def test_checkpoint_state_from_stream_instance():
assert actual_message == _as_state(
{"teams": {"updated_at": "2022-09-11"}, "managers": {"updated": "expected_here"}}, "managers", {"updated": "expected_here"}
)


def test_airbyte_record_message_custom_data_validation_error():
invalid_data = "Not a dict"
with pytest.raises(ValueError):
AirbyteRecordMessage(stream="stream", data=invalid_data, emitted_at=GLOBAL_EMITTED_AT)


def test_airbyte_record_message_valid_data():
valid_data = {"foo": "bar"}
AirbyteRecordMessage(stream="stream", data=valid_data, emitted_at=GLOBAL_EMITTED_AT)

0 comments on commit 18da341

Please sign in to comment.