diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-10 09:23:50 +0000 |
commit | 4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53 (patch) | |
tree | 1084b1a2dd9f2782031b4aa79608db08968a5837 /sqlglot/expressions.py | |
parent | Releasing debian version 17.9.1-1. (diff) | |
download | sqlglot-4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53.tar.xz sqlglot-4cc7d5a6dcda8f275b4156a9a23bbe5380be1b53.zip |
Merging upstream version 17.11.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/expressions.py')
-rw-r--r-- | sqlglot/expressions.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py index f8e9fee..c207751 100644 --- a/sqlglot/expressions.py +++ b/sqlglot/expressions.py @@ -192,6 +192,13 @@ class Expression(metaclass=_Expression): return self.text("alias") @property + def alias_column_names(self) -> t.List[str]: + table_alias = self.args.get("alias") + if not table_alias: + return [] + return [c.name for c in table_alias.args.get("columns") or []] + + @property def name(self) -> str: return self.text("this") @@ -884,13 +891,6 @@ class Predicate(Condition): class DerivedTable(Expression): @property - def alias_column_names(self) -> t.List[str]: - table_alias = self.args.get("alias") - if not table_alias: - return [] - return [c.name for c in table_alias.args.get("columns") or []] - - @property def selects(self) -> t.List[Expression]: return self.this.selects if isinstance(self.this, Subqueryable) else [] @@ -4860,8 +4860,18 @@ def maybe_parse( return sqlglot.parse_one(sql, read=dialect, into=into, **opts) +@t.overload +def maybe_copy(instance: None, copy: bool = True) -> None: + ... + + +@t.overload def maybe_copy(instance: E, copy: bool = True) -> E: - return instance.copy() if copy else instance + ... + + +def maybe_copy(instance, copy=True): + return instance.copy() if copy and instance else instance def _is_wrong_expression(expression, into): |