summaryrefslogtreecommitdiffstats
path: root/sqlglot/helper.py
diff options
context:
space:
mode:
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