Skip to content

Commit 87fda9d

Browse files
committed
Fixups
1 parent 0ba33ad commit 87fda9d

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

sqlglot/dialects/duckdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,12 +1187,12 @@ class Generator(generator.Generator):
11871187
exp.DayOfYear: rename_func("DAYOFYEAR"),
11881188
exp.Dayname: lambda self, e: (
11891189
self.func("STRFTIME", e.this, exp.Literal.string("%a"))
1190-
if e.args.get("name_format")
1190+
if e.args.get("abbreviated")
11911191
else self.func("DAYNAME", e.this)
11921192
),
11931193
exp.Monthname: lambda self, e: (
11941194
self.func("STRFTIME", e.this, exp.Literal.string("%b"))
1195-
if e.args.get("name_format")
1195+
if e.args.get("abbreviated")
11961196
else self.func("MONTHNAME", e.this)
11971197
),
11981198
exp.DataType: _datatype_sql,

sqlglot/dialects/snowflake.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ class Parser(parser.Parser):
750750
"DATE_TRUNC": _date_trunc_to_time,
751751
"DATEADD": _build_date_time_add(exp.DateAdd),
752752
"DATEDIFF": _build_datediff,
753-
"DAYNAME": lambda args: exp.Dayname(this=seq_get(args, 0), name_format=True),
753+
"DAYNAME": lambda args: exp.Dayname(this=seq_get(args, 0), abbreviated=True),
754754
"DAYOFWEEKISO": exp.DayOfWeekIso.from_arg_list,
755755
"DIV0": _build_if_from_div0,
756756
"DIV0NULL": _build_if_from_div0null,
@@ -777,7 +777,7 @@ class Parser(parser.Parser):
777777
"MD5_BINARY": exp.MD5Digest.from_arg_list,
778778
"MD5_NUMBER_LOWER64": exp.MD5NumberLower64.from_arg_list,
779779
"MD5_NUMBER_UPPER64": exp.MD5NumberUpper64.from_arg_list,
780-
"MONTHNAME": lambda args: exp.Monthname(this=seq_get(args, 0), name_format=True),
780+
"MONTHNAME": lambda args: exp.Monthname(this=seq_get(args, 0), abbreviated=True),
781781
"LAST_DAY": lambda args: exp.LastDay(
782782
this=seq_get(args, 0), unit=map_date_part(seq_get(args, 1))
783783
),

sqlglot/expressions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6564,7 +6564,7 @@ class DayOfYear(Func):
65646564

65656565

65666566
class Dayname(Func):
6567-
arg_types = {"this": True, "name_format": False}
6567+
arg_types = {"this": True, "abbreviated": False}
65686568

65696569

65706570
class ToDays(Func):
@@ -7518,7 +7518,7 @@ class Month(Func):
75187518

75197519

75207520
class Monthname(Func):
7521-
arg_types = {"this": True, "name_format": False}
7521+
arg_types = {"this": True, "abbreviated": False}
75227522

75237523

75247524
class AddMonths(Func):

tests/dialects/test_duckdb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ def test_duckdb(self):
369369
parse_one("a // b", read="duckdb").assert_is(exp.IntDiv).sql(dialect="duckdb"), "a // b"
370370
)
371371

372+
self.validate_identity("DAYNAME(x)")
373+
self.validate_identity("MONTHNAME(x)")
372374
self.validate_identity(
373375
"SELECT LIST_TRANSFORM([5, NULL, 6], (x, y) -> COALESCE(x, y, 0) + 1)"
374376
)

0 commit comments

Comments
 (0)