diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-19 10:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-19 10:22:09 +0000 |
commit | 66af5c6fc22f6f11e9ea807b274e011a6f64efb7 (patch) | |
tree | 08ceed3b311b7b343935c1e55941b9d15e6f56d8 /sqlglot/helper.py | |
parent | Releasing debian version 11.3.6-1. (diff) | |
download | sqlglot-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.py | 17 |
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 |