airbytehq / airbyte-api-python-sdk

MIT License
38 stars 13 forks source link

Airbyte create connection is failing #47

Open shlokabhalgat opened 1 year ago

shlokabhalgat commented 1 year ago

Script used to test create_connection for Airbyte

import airbyte
from airbyte.models import shared

s = airbyte.Airbyte(
    security=shared.Security(
        basic_auth=shared.SchemeBasicAuth(
            password="password",
            username="airbyte",
        ),
    ),
)

req = shared.ConnectionCreateRequest(
    configurations=shared.StreamConfigurations(
        streams=[
            shared.StreamConfiguration(
                cursor_field=[
                    'violet',
                ],
                name='at BMW',
                primary_key=[
                    [
                        'pfft',
                    ],
                ],
                sync_mode=shared.ConnectionSyncModeEnum.FULL_REFRESH_APPEND,
            ),
        ],
    ),
    data_residency=shared.GeographyEnum.AUTO,
    destination_id='083eafc8-5591-44e0-a570-f6dd427d83a5',
    name='mesh interactive',
    namespace_definition=shared.NamespaceDefinitionEnum.DESTINATION,
    namespace_format='${SOURCE_NAMESPACE}',
    non_breaking_schema_updates_behavior=shared.NonBreakingSchemaUpdatesBehaviorEnum.IGNORE,
    prefix='port Idaho',
    schedule=shared.ConnectionSchedule(
        cron_expression='productivity',
        schedule_type=shared.ScheduleTypeEnum.MANUAL,
    ),
    source_id='b3fd2fd3-07d6-40cb-97ea-6dfc635b80f2',
    status=shared.ConnectionStatusEnum.INACTIVE,
)

res = s.connections.create_connection(req)

if res.connection_response is not None:
    print("connected!!!!")

Testing

Setup and launch of Airbyte was done using docker as given here

Error

Traceback (most recent call last):
  File "/Users/shlokabhalgat/Documents/github/test_lego/test_lego.py", line 1, in <module>
    import airbyte
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/__init__.py", line 3, in <module>
    from .sdk import *
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/sdk.py", line 4, in <module>
    from .connections import Connections
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/connections.py", line 5, in <module>
    from airbyte.models import errors, operations, shared
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/models/operations/__init__.py", line 3, in <module>
    from .canceljob import *
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/models/operations/canceljob.py", line 6, in <module>
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""
    from ..shared import jobresponse as shared_jobresponse
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/models/shared/__init__.py", line 114, in <module>
    from .source_aws_cloudtrail import *
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/models/shared/source_aws_cloudtrail.py", line 14, in <module>
    class SourceAwsCloudtrail:
  File "/Users/shlokabhalgat/opt/anaconda3/envs/myenv/lib/python3.9/site-packages/airbyte/models/shared/source_aws_cloudtrail.py", line 23, in SourceAwsCloudtrail
    start_date: Optional[date] = dataclasses.field(default=dateutil.parser.parse('1970-01-01').date(), metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('start_date'), 'encoder': utils.dateisoformat(True), 'decoder': utils.datefromisoformat, 'exclude': lambda f: f is None }})
NameError: name 'dateutil' is not defined
dang-kaiko commented 1 year ago

I'm having the same issue, and I believe merging this PR https://github.com/airbytehq/airbyte-api-python-sdk/pull/48 will fix it.

dang-kaiko commented 1 year ago

In the meantime, you can revert back to the version 0.35.4 which was before this change introduced.