MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / generate_alias

Function generate_alias

web/pgadmin/utils/sqlautocomplete/autocomplete.py:76–86  ·  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

74
75
76def 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
89class SQLAutoComplete():

Callers 4

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

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected