summaryrefslogtreecommitdiffstats
path: root/sqlglot/schema.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-11-01 05:12:42 +0000
commitc51a9844b869fd7cd69e5cc7658d34f61a865185 (patch)
tree55706c65ce7e19626aabf7ff4dde0e1a51b739db /sqlglot/schema.py
parentReleasing debian version 18.17.0-1. (diff)
downloadsqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.tar.xz
sqlglot-c51a9844b869fd7cd69e5cc7658d34f61a865185.zip
Merging upstream version 19.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/schema.py')
-rw-r--r--sqlglot/schema.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/sqlglot/schema.py b/sqlglot/schema.py
index 778378c..acf9bc4 100644
--- a/sqlglot/schema.py
+++ b/sqlglot/schema.py
@@ -3,10 +3,9 @@ from __future__ import annotations
import abc
import typing as t
-import sqlglot
from sqlglot import expressions as exp
from sqlglot.dialects.dialect import Dialect
-from sqlglot.errors import ParseError, SchemaError
+from sqlglot.errors import SchemaError
from sqlglot.helper import dict_depth
from sqlglot.trie import TrieResult, in_trie, new_trie
@@ -448,19 +447,16 @@ class MappingSchema(AbstractMappingSchema, Schema):
def normalize_name(
- name: str | exp.Identifier,
+ identifier: str | exp.Identifier,
dialect: DialectType = None,
is_table: bool = False,
normalize: t.Optional[bool] = True,
) -> str:
- try:
- identifier = sqlglot.maybe_parse(name, dialect=dialect, into=exp.Identifier)
- except ParseError:
- return name if isinstance(name, str) else name.name
+ if isinstance(identifier, str):
+ identifier = exp.parse_identifier(identifier, dialect=dialect)
- name = identifier.name
if not normalize:
- return name
+ return identifier.name
# This can be useful for normalize_identifier
identifier.meta["is_table"] = is_table