summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/sqlite.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-08 07:22:12 +0000
commit243d9a15edd910136313a7a9fa7d7f24b494e169 (patch)
tree22d768ca708dc5caa8230705a9155ba1a343502b /sqlglot/dialects/sqlite.py
parentAdding upstream version 11.3.0. (diff)
downloadsqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.tar.xz
sqlglot-243d9a15edd910136313a7a9fa7d7f24b494e169.zip
Adding upstream version 11.3.3.upstream/11.3.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 ""