Skip to content

Commit ca4d652

Browse files
committed
disctinct then top in select
1 parent 9b8b11f commit ca4d652

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

sqlalchemy_iris/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ def _get_limit_or_fetch(self, select):
351351
def get_select_precolumns(self, select, **kw):
352352

353353
text = ""
354-
if select._has_row_limiting_clause and self._use_top(select):
355-
text += "TOP %s " % self.process(
356-
self._get_limit_or_fetch(select), **kw
357-
)
358-
359354
if select._distinct or select._distinct_on:
360355
if select._distinct_on:
361356
text += (
@@ -371,6 +366,11 @@ def get_select_precolumns(self, select, **kw):
371366
else:
372367
text += "DISTINCT "
373368

369+
if select._has_row_limiting_clause and self._use_top(select):
370+
text += "TOP %s " % self.process(
371+
self._get_limit_or_fetch(select), **kw
372+
)
373+
374374
return text
375375

376376
def _use_top(self, select):

sqlalchemy_iris/requirements.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,31 @@ def computed_columns_reflect_persisted(self):
6565
"""If persistence information is returned by the reflection of
6666
computed columns"""
6767
return exclusions.open()
68+
69+
@property
70+
def two_phase_transactions(self):
71+
"""Target database must support two-phase transactions."""
72+
73+
return exclusions.closed()
74+
75+
@property
76+
def binary_comparisons(self):
77+
"""target database/driver can allow BLOB/BINARY fields to be compared
78+
against a bound parameter value.
79+
"""
80+
81+
return exclusions.closed()
82+
83+
@property
84+
def binary_literals(self):
85+
"""target backend supports simple binary literals, e.g. an
86+
expression like::
87+
88+
SELECT CAST('foo' AS BINARY)
89+
90+
Where ``BINARY`` is the type emitted from :class:`.LargeBinary`,
91+
e.g. it could be ``BLOB`` or similar.
92+
"""
93+
94+
return exclusions.closed()
95+

0 commit comments

Comments
 (0)