buildai-cli 0.3.75__tar.gz → 0.3.76__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/PKG-INFO +1 -1
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/query.py +13 -4
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/pyproject.toml +1 -1
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/.gitignore +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/AGENTS.md +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/CLAUDE.md +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/buildai_bootstrap.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/__init__.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/_has_core.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/auth_local.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/__init__.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/api_proxy.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/auth.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/__init__.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/broker.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/common.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/migrate.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/schema.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/status.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/db/tunnel.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/dev.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/doctor.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/gigcamera.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/commands/processing.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/config.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/console.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/context.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/db_broker.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/guard.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/internal_api.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/main.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/nl_query/__init__.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/nl_query/dataset_tools.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/ops_init.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/output.py +0 -0
- {buildai_cli-0.3.75 → buildai_cli-0.3.76}/cli/pagination.py +0 -0
|
@@ -65,6 +65,8 @@ def _is_write_query(sql: str) -> bool:
|
|
|
65
65
|
return True
|
|
66
66
|
|
|
67
67
|
normalized = _normalize_sql(sql)
|
|
68
|
+
if normalized.startswith("WITH ") and re.search(r"\b(INSERT|UPDATE|DELETE)\b", normalized):
|
|
69
|
+
return True
|
|
68
70
|
for keyword in ("VACUUM", "REASSIGN"):
|
|
69
71
|
if normalized.startswith(keyword + " ") or normalized == keyword:
|
|
70
72
|
return True
|
|
@@ -98,14 +100,21 @@ def _is_ddl_query(sql: str) -> bool:
|
|
|
98
100
|
def _is_select_query(sql: str) -> bool:
|
|
99
101
|
"""Return whether the SQL is a row-returning query."""
|
|
100
102
|
|
|
103
|
+
import sqlparse
|
|
104
|
+
from sqlparse.tokens import DML
|
|
105
|
+
|
|
101
106
|
normalized = _normalize_sql(sql)
|
|
102
107
|
if normalized.startswith("SELECT "):
|
|
103
108
|
return True
|
|
104
109
|
if normalized.startswith("WITH "):
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
statements = sqlparse.parse(sql)
|
|
111
|
+
if statements:
|
|
112
|
+
for token in statements[0].tokens:
|
|
113
|
+
if token.is_whitespace:
|
|
114
|
+
continue
|
|
115
|
+
if token.ttype is DML:
|
|
116
|
+
return token.value.upper() == "SELECT"
|
|
117
|
+
return re.search(r"\b(INSERT|UPDATE|DELETE)\b", normalized) is None
|
|
109
118
|
return any(normalized.startswith(keyword) for keyword in ("SHOW ", "EXPLAIN ", "TABLE "))
|
|
110
119
|
|
|
111
120
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|