Skip to content

Commit

Permalink
fix: Use nulls_first to order results in incremental SQL streams
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 8, 2023
1 parent d755024 commit 5c658c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion singer_sdk/streams/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import abc
import typing as t

from sqlalchemy import nulls_first

import singer_sdk.helpers._catalog as catalog
from singer_sdk._singerlib import CatalogEntry, MetadataMapping
from singer_sdk.connectors import SQLConnector
Expand Down Expand Up @@ -189,7 +191,7 @@ def get_records(self, context: dict | None) -> t.Iterable[dict[str, t.Any]]:

if self.replication_key:
replication_key_col = table.columns[self.replication_key]
query = query.order_by(replication_key_col)
query = query.order_by(nulls_first(replication_key_col))

start_val = self.get_starting_replication_key_value(context)
if start_val:
Expand Down

0 comments on commit 5c658c2

Please # to comment.