Coverage for packages/sql-smith/src/sql_smith/query/sql_server/select_query.py: 56%

9 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1from sql_smith.functions import literal 

2from sql_smith.query import SelectQuery as BaseSelectQuery 

3 

4 

5class SelectQuery(BaseSelectQuery): 

6 """Sql Server SelectQuery to support offset and limit.""" 

7 

8 def _apply_offset(self, query: "ExpressionInterface") -> "ExpressionInterface": 

9 if self._offset is None or self._limit is None: 

10 return query 

11 return query.append( 

12 "OFFSET {} ROWS FETCH NEXT {} ROWS ONLY", 

13 literal(self._offset), 

14 literal(self._limit), 

15 ) 

16 

17 def _apply_limit(self, query: "ExpressionInterface") -> "ExpressionInterface": 

18 return query