MCPcopy Index your code
hub / github.com/dbcli/mycli / query_starts_with

Function query_starts_with

mycli/packages/sql_utils.py:341–345  ·  view source on GitHub ↗

Check if the query starts with any item from *prefixes*.

(query: str, prefixes: list[str])

Source from the content-addressed store, hash-verified

339
340
341def query_starts_with(query: str, prefixes: list[str]) -> bool:
342 """Check if the query starts with any item from *prefixes*."""
343 prefixes = [prefix.lower() for prefix in prefixes]
344 formatted_sql = sqlparse.format(query.lower(), strip_comments=True)
345 return bool(formatted_sql) and formatted_sql.split()[0] in prefixes
346
347
348def queries_start_with(queries: str, prefixes: list[str]) -> bool:

Callers 4

test_query_starts_withFunction · 0.90
queries_start_withFunction · 0.85
is_destructiveFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by 2

test_query_starts_withFunction · 0.72