Skip to content

Commit 2d108b7

Browse files
committed
fix for 1.4
1 parent f447f8b commit 2d108b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sqlalchemy_iris/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,9 @@ def _get_default_order_by(self, select_stmt, select):
574574

575575
if not _order_by_clauses:
576576
# If no ORDER BY clause, use the primary key
577-
if select_stmt.froms and isinstance(select_stmt.froms[0], schema.Table):
578-
table = select.froms[0]
577+
froms = select_stmt.get_final_froms()
578+
if froms and isinstance(froms[0], schema.Table):
579+
table = froms[0]
579580
if table.primary_key and table.primary_key.columns:
580581
_order_by_clauses = [
581582
sql_util.unwrap_label_reference(c)

0 commit comments

Comments
 (0)