MCPcopy Index your code
hub / github.com/dbcli/pgcli / is_destructive

Function is_destructive

pgcli/packages/parseutils/__init__.py:29–38  ·  view source on GitHub ↗

Returns if any of the queries in *queries* is destructive.

(queries, keywords)

Source from the content-addressed store, hash-verified

27
28
29def is_destructive(queries, keywords):
30 """Returns if any of the queries in *queries* is destructive."""
31 for query in sqlparse.split(queries):
32 if query:
33 formatted_sql = sqlparse.format(query.lower(), strip_comments=True).strip()
34 if "unconditional_update" in keywords and query_is_unconditional_update(formatted_sql):
35 return True
36 if query_starts_with(formatted_sql, keywords):
37 return True
38 return False
39
40
41def parse_destructive_warning(warning_level):

Callers 4

test_is_destructiveFunction · 0.90
execute_from_fileMethod · 0.85
execute_commandMethod · 0.85

Calls 2

query_starts_withFunction · 0.85

Tested by 1

test_is_destructiveFunction · 0.72