Generate a table alias, consisting of all upper-case letters in the table name, or, if there are no upper-case letters, the first letter + all letters preceded by _ param tbl - unescaped name of the table to alias
(tbl)
| 74 | |
| 75 | |
| 76 | def generate_alias(tbl): |
| 77 | """Generate a table alias, consisting of all upper-case letters in |
| 78 | the table name, or, if there are no upper-case letters, the first letter + |
| 79 | all letters preceded by _ |
| 80 | param tbl - unescaped name of the table to alias |
| 81 | """ |
| 82 | return "".join( |
| 83 | [letter for letter in tbl if letter.isupper()] or |
| 84 | [letter for letter, prev in zip(tbl, "_" + tbl) |
| 85 | if prev == "_" and letter != "_"] |
| 86 | ) |
| 87 | |
| 88 | |
| 89 | class SQLAutoComplete(): |
no test coverage detected