summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/sqlite.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/sqlite.py')
-rw-r--r--sqlglot/dialects/sqlite.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sqlglot/dialects/sqlite.py b/sqlglot/dialects/sqlite.py
index 86603b5..fb99d49 100644
--- a/sqlglot/dialects/sqlite.py
+++ b/sqlglot/dialects/sqlite.py
@@ -13,10 +13,6 @@ from sqlglot.dialects.dialect import (
from sqlglot.tokens import TokenType
-def _fetch_sql(self, expression):
- return self.limit_sql(exp.Limit(expression=expression.args.get("count")))
-
-
# https://www.sqlite.org/lang_aggfunc.html#group_concat
def _group_concat_sql(self, expression):
this = expression.this
@@ -94,9 +90,17 @@ class SQLite(Dialect):
exp.TimeStrToTime: lambda self, e: self.sql(e, "this"),
exp.TryCast: no_trycast_sql,
exp.GroupConcat: _group_concat_sql,
- exp.Fetch: _fetch_sql,
}
+ def fetch_sql(self, expression):
+ return self.limit_sql(exp.Limit(expression=expression.args.get("count")))
+
+ def least_sql(self, expression):
+ if len(expression.expressions) > 1:
+ return rename_func("MIN")(self, expression)
+
+ return self.expressions(expression)
+
def transaction_sql(self, expression):
this = expression.this
this = f" {this}" if this else ""