airbytehq / airbytehq/PyAirbyte

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

Ouverte
#666 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
344
Forks
77
Merge moyen
1 j 11 h
PR mergées (30 j)
35

Description

## 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?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.