Coverage for packages/sql-smith/src/sql_smith/capability/has_limit.py: 90%

10 statements  

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

1from sql_smith.functions import literal 

2 

3 

4class HasLimitMixin: 

5 def limit(self, new_limit: int | None = None): 

6 self._limit = new_limit 

7 return self 

8 

9 @property 

10 def is_limited(self) -> bool: 

11 """Returns True when the query has a LIMIT.""" 

12 return self._limit is not None 

13 

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

15 return query.append("LIMIT {}", literal(self._limit)) if self._limit else query