airbytehq / airbytehq/PyAirbyte

When using source.read() getting an error: "getCursorField() is null"

Đang mở
#666 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
344
Fork
77
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
35

Mô tả

## Code example:
```python
# Set up the source
source = ab.get_source('source-redshift')
source.set_config(config=config)
source.select_streams(tables)

# Read data from the selected stream
read_result = source.read()
```

## Getting the following error:
`java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "io.airbyte.protocol.models.v0.ConfiguredAirbyteStream.getCursorField()" is null`

### Full stacktrace:
```
ERROR i.a.c.i.b.AirbyteExceptionHandler(uncaughtException):64 Something went wrong in the connector. See the logs for more details. java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "io.airbyte.protocol.models.v0.ConfiguredAirbyteStream.getCursorField()" is null
at io.airbyte.cdk.db.IncrementalUtils.getCursorField(IncrementalUtils.java:18) ~[airbyte-cdk-core-0.20.4.jar:?]
at io.airbyte.cdk.db.IncrementalUtils.getCursorFieldOptional(IncrementalUtils.java:29) ~[airbyte-cdk-core-0.20.4.jar:?]
at io.airbyte.cdk.integrations.source.relationaldb.AbstractDbSource.validateCursorFieldForIncrementalTables(AbstractDbSource.java:210) ~[airbyte-cdk-db-sources-0.20.4.jar:?]
at io.airbyte.cdk.integrations.source.relationaldb.AbstractDbSource.read(AbstractDbSource.java:167) ~[airbyte-cdk-db-sources-0.20.4.jar:?]
at io.airbyte.cdk.integrations.base.IntegrationRunner.readSerial(IntegrationRunner.java:275) ~[airbyte-cdk-core-0.20.4.jar:?]
at io.airbyte.cdk.integrations.base.IntegrationRunner.runInternal(IntegrationRunner.java:173) ~[airbyte-cdk-core-0.20.4.jar:?]
at io.airbyte.cdk.integrations.base.IntegrationRunner.run(IntegrationRunner.java:125) ~[airbyte-cdk-core-0.20.4.jar:?]
at io.airbyte.integrations.source.redshift.RedshiftSource.main(RedshiftSource.java:141) ~[io.airbyte.airbyte-integrations.connectors-source-redshift.jar:?]
```

## Environment
OS:
```
Mac:
ProductName: macOS
ProductVersion: 14.6.1
BuildVersion: 23G93

Linux:
Linux py-stg-7d7fdf6677-kn8w7 6.1.102-111.182.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 13 22:23:09 UTC 2024 x86_64 GNU/Linux
```

PyAirbyte version:
```
pip freeze --all | grep airbyte
airbyte==0.24.2
airbyte-api==0.52.2
airbyte-cdk==6.45.6
airbyte_protocol_models_dataclasses==0.14.5
airbyte_protocol_models_pdv2==0.13.1
```

## Workaround
When using `get_records` it works:
```
read_result = source.get_records(stream=table)
```

Is there a workaround to avoid using the cursor field in this case?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.