summaryrefslogtreecommitdiffstats
path: root/sqlglot/helper.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-19 10:22:09 +0000
commit66af5c6fc22f6f11e9ea807b274e011a6f64efb7 (patch)
tree08ceed3b311b7b343935c1e55941b9d15e6f56d8 /sqlglot/helper.py
parentReleasing debian version 11.3.6-1. (diff)
downloadsqlglot-66af5c6fc22f6f11e9ea807b274e011a6f64efb7.tar.xz
sqlglot-66af5c6fc22f6f11e9ea807b274e011a6f64efb7.zip
Merging upstream version 11.4.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/helper.py')
-rw-r--r--sqlglot/helper.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/sqlglot/helper.py b/sqlglot/helper.py
index 68e0383..6eff974 100644
--- a/sqlglot/helper.py
+++ b/sqlglot/helper.py
@@ -403,3 +403,20 @@ def first(it: t.Iterable[T]) -> T:
Useful for sets.
"""
return next(i for i in it)
+
+
+def should_identify(text: str, identify: str | bool) -> bool:
+ """Checks if text should be identified given an identify option.
+
+ Args:
+ text: the text to check.
+ identify: "always" | True - always returns true, "safe" - true if no upper case
+
+ Returns:
+ Whether or not a string should be identified.
+ """
+ if identify is True or identify == "always":
+ return True
+ if identify == "safe":
+ return not any(char.isupper() for char in text)
+ return False