MCPcopy Create free account
hub / github.com/dbcli/mycli / need_completion_refresh

Function need_completion_refresh

mycli/packages/sql_utils.py:428–451  ·  view source on GitHub ↗

Determines if the completion needs a refresh by checking if the sql statement is an alter, create, drop or change db.

(queries: str)

Source from the content-addressed store, hash-verified

426
427
428def need_completion_refresh(queries: str) -> bool:
429 """Determines if the completion needs a refresh by checking if the sql
430 statement is an alter, create, drop or change db."""
431 for query in sqlparse.split(queries):
432 try:
433 first_token = query.split()[0]
434 if first_token.lower() in (
435 "alter",
436 "create",
437 "use",
438 "/use",
439 "\\r",
440 "\\u",
441 "/r",
442 "/u",
443 "connect",
444 "/connect",
445 "drop",
446 "rename",
447 ):
448 return True
449 except Exception:
450 continue
451 return False
452
453
454def need_completion_reset(queries: str) -> bool:

Calls 1

splitMethod · 0.80