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-zendesk-support: TypeError: unhashable type: 'list' #244

Closed
nakamichiworks opened this issue May 17, 2024 · 2 comments · Fixed by #251
Closed

source-zendesk-support: TypeError: unhashable type: 'list' #244

nakamichiworks opened this issue May 17, 2024 · 2 comments · Fixed by #251
Assignees
Labels
bug Something isn't working

Comments

@nakamichiworks
Copy link
Contributor

I got the following error when I ran source-zendesk-support connector.

import os

import airbyte as ab

source = ab.get_source(
    "source-zendesk-support",
    config={
        "subdomain": os.getenv("ZENDESK_API_SUBDOMAIN"),
        "start_date": "2024-05-17T00:00:00Z",
        "credentials": {
            "credentials": "api_token",
            "email": os.getenv("ZENDESK_API_EMAIL"),
            "api_token": os.getenv("ZENDESK_API_TOKEN"),
        },
    },
)
source.check()
source.select_streams(["tickets"])
result = source.read()
Traceback (most recent call last):
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/sources/base.py", line 734, in read
    cache_processor.process_airbyte_messages(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/_future_cdk/record_processor.py", line 217, in process_airbyte_messages
    self.write_all_stream_data(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/_future_cdk/record_processor.py", line 226, in write_all_stream_data
    self.write_stream_data(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/_future_cdk/sql_processor.py", line 508, in write_stream_data
    final_table_name = self._ensure_final_table_exists(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/_future_cdk/sql_processor.py", line 402, in _ensure_final_table_exists
    for column_name, sql_type in self._get_sql_column_definitions(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/_future_cdk/sql_processor.py", line 476, in _get_sql_column_definitions
    columns[clean_prop_name] = self.type_converter.to_sql_type(
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/types.py", line 123, in to_sql_type
    airbyte_type, _ = _get_airbyte_type(json_schema_property_def)
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/types.py", line 67, in _get_airbyte_type
    if json_schema_type in {"string", "number", "boolean", "integer"}:
TypeError: unhashable type: 'list'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/private/tmp/test-pyairbyte/load_zendesk_support_data.py", line 19, in <module>
    result = source.read()
  File "/private/tmp/test-pyairbyte/.venv/lib/python3.9/site-packages/airbyte/sources/base.py", line 745, in read
    raise exc.AirbyteConnectorFailedError(
airbyte.exceptions.AirbyteConnectorFailedError: AirbyteConnectorFailedError: Connector failed.

After debugging, I found that this JSON schema type is not properly handled by _get_airbyte_type() function, which means json_schema_type = ["null", "object", "string"] causes TypeError: unhashable type: 'list'.

Can I fix this, or do you have any workaround?


Package versions:

  • PyAirbyte version: 0.11.0 (latest)
  • airbyte-source-zendesk-support version: 2.6.3 (latest)
@aaronsteers aaronsteers added the bug Something isn't working label May 17, 2024
@aaronsteers
Copy link
Contributor

@nakamichiworks - Thanks for reporting this. I can see and confirm this is an issue. The "in" check should first check if the object is a string, so as to avoid the "unhashable" error. We can also add this scenario to our unit tests. I'm considering also wrapping most/all of the logic in a try block so that unexpected inputs can still have a safe failover type (str or json).

@aaronsteers
Copy link
Contributor

@nakamichiworks - This should be resolved by:

Which just merged.

Can you retry using PyAirbyte 0.11.1 (released just now) and let us know if this resolves your issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants