|
10 | 10 | import sys |
11 | 11 | import textwrap |
12 | 12 | import typing as t |
| 13 | +from builtins import type as Type |
13 | 14 | from collections import deque |
| 15 | +from collections.abc import Collection, Iterator, Mapping, MutableMapping, Sequence |
14 | 16 | from copy import deepcopy |
15 | 17 | from decimal import Decimal |
16 | 18 | from functools import reduce |
17 | | -from collections.abc import Iterator, Sequence, Collection, Mapping, MutableMapping |
18 | | -from sqlglot._typing import E, T |
| 19 | + |
| 20 | +from sqlglot._typing import E, GeneratorNoDialectArgs, ParserNoDialectArgs, T |
19 | 21 | from sqlglot.errors import ParseError |
20 | 22 | from sqlglot.helper import ( |
21 | 23 | camel_to_snake_case, |
|
24 | 26 | to_bool, |
25 | 27 | trait, |
26 | 28 | ) |
27 | | - |
28 | 29 | from sqlglot.tokenizer_core import Token |
29 | | -from builtins import type as Type |
30 | | -from sqlglot._typing import GeneratorNoDialectArgs, ParserNoDialectArgs |
31 | 30 |
|
32 | 31 | if t.TYPE_CHECKING: |
33 | | - from typing_extensions import Self, Unpack, Concatenate |
| 32 | + from typing_extensions import Concatenate, Self, Unpack |
| 33 | + |
| 34 | + from sqlglot._typing import P |
34 | 35 | from sqlglot.dialects.dialect import DialectType |
35 | 36 | from sqlglot.expressions.datatypes import DATA_TYPE, DataType, DType, Interval |
36 | 37 | from sqlglot.expressions.query import Select |
37 | | - from sqlglot._typing import P |
38 | 38 |
|
39 | 39 | R = t.TypeVar("R") |
40 | 40 |
|
@@ -1808,8 +1808,10 @@ def output_name(self) -> str: |
1808 | 1808 |
|
1809 | 1809 |
|
1810 | 1810 | # https://docs.snowflake.com/en/sql-reference/identifier-literal |
| 1811 | +# "expressions" holds the arguments when the resolved identifier is invoked as a |
| 1812 | +# function, e.g. `IDENTIFIER('my_func')(1, 2)` |
1811 | 1813 | class DynamicIdentifier(Expression, Func): |
1812 | | - pass |
| 1814 | + arg_types = {"this": True, "expressions": False} |
1813 | 1815 |
|
1814 | 1816 |
|
1815 | 1817 | class Opclass(Expression): |
@@ -2425,7 +2427,8 @@ def convert(value: t.Any, copy: bool = False) -> Expr: |
2425 | 2427 |
|
2426 | 2428 | return _Array(expressions=[convert(v, copy=copy) for v in value]) |
2427 | 2429 | if isinstance(value, dict): |
2428 | | - from sqlglot.expressions.array import Array as _Array, Map as _Map |
| 2430 | + from sqlglot.expressions.array import Array as _Array |
| 2431 | + from sqlglot.expressions.array import Map as _Map |
2429 | 2432 |
|
2430 | 2433 | return _Map( |
2431 | 2434 | keys=_Array(expressions=[convert(k, copy=copy) for k in value]), |
|
0 commit comments