MCPcopy
hub / github.com/dbcli/pgcli / _strip_named_query

Function _strip_named_query

pgcli/packages/sqlcompletion.py:152–161  ·  view source on GitHub ↗

This will strip "save named query" command in the beginning of the line: '\ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc' ' \ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc'

(txt)

Source from the content-addressed store, hash-verified

150
151
152def _strip_named_query(txt):
153 """
154 This will strip "save named query" command in the beginning of the line:
155 '\ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc'
156 ' \ns zzz SELECT * FROM abc' -> 'SELECT * FROM abc'
157 """
158
159 if named_query_regex.match(txt):
160 txt = named_query_regex.sub("", txt)
161 return txt
162
163
164function_body_pattern = re.compile(r"(\$.*?\$)([\s\S]*?)\1", re.M)

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected