Check if the query starts with any item from *prefixes*.
(query: str, prefixes: list[str])
| 339 | |
| 340 | |
| 341 | def 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 | |
| 348 | def queries_start_with(queries: str, prefixes: list[str]) -> bool: |