File tree Expand file tree Collapse file tree
unit_tests/sources/declarative/parsers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4339,8 +4339,14 @@ def _get_catalog_defined_cursor_field(
43394339 configured_stream = self ._stream_name_to_configured_stream .get (stream_name )
43404340
43414341 # Depending on the operation is being performed, there may not be a configured stream yet. In this
4342- # case we return None which will then use the default cursor field defined on the cursor model
4343- if not configured_stream or not configured_stream .cursor_field :
4342+ # case we return None which will then use the default cursor field defined on the cursor model.
4343+ # We also treat cursor_field: [""] (list with empty string) as no cursor field, since this can
4344+ # occur when the platform serializes "no cursor configured" streams incorrectly.
4345+ if (
4346+ not configured_stream
4347+ or not configured_stream .cursor_field
4348+ or not configured_stream .cursor_field [0 ]
4349+ ):
43444350 return None
43454351 elif len (configured_stream .cursor_field ) > 1 :
43464352 raise ValueError (
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ def get_cursor_field_from_stream(stream: Stream) -> Optional[str]:
3434 raise ValueError (
3535 f"Nested cursor fields are not supported. Got { stream .cursor_field } for { stream .name } "
3636 )
37- elif len (stream .cursor_field ) == 0 :
37+ elif len (stream .cursor_field ) == 0 or not stream .cursor_field [0 ]:
38+ # Treat cursor_field: [""] (list with empty string) as no cursor field
3839 return None
3940 else :
4041 return stream .cursor_field [0 ]
Original file line number Diff line number Diff line change @@ -5051,6 +5051,12 @@ def test_create_stream_with_multiple_schema_loaders():
50515051 "updated_at" ,
50525052 id = "test_allow_catalog_defined_cursor_field_false_defaults_to_stream_defined_cursor_field" ,
50535053 ),
5054+ pytest .param (
5055+ True ,
5056+ "" ,
5057+ "updated_at" ,
5058+ id = "test_empty_string_catalog_cursor_field_defaults_to_stream_defined_cursor_field" ,
5059+ ),
50545060 ],
50555061)
50565062def test_catalog_defined_cursor_field (
You can’t perform that action at this time.
0 commit comments