MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / generate_alias

Function generate_alias

mssqlcli/mssqlcompleter.py:61–68  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

59
60
61def generate_alias(tbl):
62 """ Generate a table alias, consisting of all upper-case letters in
63 the table name, or, if there are no upper-case letters, the first letter +
64 all letters preceded by _
65 param tbl - unescaped name of the table to alias
66 """
67 return ''.join([l for l in tbl if l.isupper()] or
68 [l for l, prev in zip(tbl, '_' + tbl) if prev == '_' and l != '_'])
69
70
71class MssqlCompleter(Completer):

Callers 4

make_candMethod · 0.85
aliasMethod · 0.85
get_join_matchesMethod · 0.85
_make_candMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected