do-not-drop 0.1.0__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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antony Arevalo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: do-not-drop
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Do-Not-Drop is a package for preventing AI agents and developers from deleting, dropping or truncating tables by mistake.
|
|
5
|
+
Keywords: sql,database,safety,ai-agents,guard
|
|
6
|
+
Author: Antony Arevalo
|
|
7
|
+
Author-email: Antony Arevalo <antonyare_93@hotmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 1 - Planning
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Project-URL: Homepage, https://github.com/antonyare93/do-not-drop
|
|
16
|
+
Project-URL: Repository, https://github.com/antonyare93/do-not-drop
|
|
17
|
+
Project-URL: Issues, https://github.com/antonyare93/do-not-drop/issues
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# do-not-drop
|
|
21
|
+
|
|
22
|
+
Do-Not-Drop is a package for preventing AI agents and developers from deleting, dropping or truncating tables by mistake.
|
|
23
|
+
|
|
24
|
+
> **Status:** early development. The API will change.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from do_not_drop import is_destructive
|
|
28
|
+
|
|
29
|
+
is_destructive("DROP TABLE users") # True
|
|
30
|
+
is_destructive("SELECT * FROM users") # False
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# do-not-drop
|
|
2
|
+
|
|
3
|
+
Do-Not-Drop is a package for preventing AI agents and developers from deleting, dropping or truncating tables by mistake.
|
|
4
|
+
|
|
5
|
+
> **Status:** early development. The API will change.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from do_not_drop import is_destructive
|
|
9
|
+
|
|
10
|
+
is_destructive("DROP TABLE users") # True
|
|
11
|
+
is_destructive("SELECT * FROM users") # False
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## License
|
|
15
|
+
|
|
16
|
+
MIT
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "do-not-drop"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Do-Not-Drop is a package for preventing AI agents and developers from deleting, dropping or truncating tables by mistake."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Antony Arevalo", email = "antonyare_93@hotmail.com" }
|
|
10
|
+
]
|
|
11
|
+
keywords = ["sql", "database", "safety", "ai-agents", "guard"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 1 - Planning",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Topic :: Database",
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.9"
|
|
19
|
+
dependencies = []
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/antonyare93/do-not-drop"
|
|
23
|
+
Repository = "https://github.com/antonyare93/do-not-drop"
|
|
24
|
+
Issues = "https://github.com/antonyare93/do-not-drop/issues"
|
|
25
|
+
|
|
26
|
+
[build-system]
|
|
27
|
+
requires = ["uv_build>=0.10.8,<0.11.0"]
|
|
28
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Do-Not-Drop: prevent AI agents and developers from deleting, dropping or
|
|
2
|
+
truncating tables by mistake.
|
|
3
|
+
|
|
4
|
+
Early development: the API will change.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import re
|
|
8
|
+
|
|
9
|
+
__all__ = ["is_destructive"]
|
|
10
|
+
|
|
11
|
+
_DESTRUCTIVE_KEYWORDS = frozenset({"DROP", "TRUNCATE", "DELETE"})
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def is_destructive(sql: str) -> bool:
|
|
15
|
+
"""Return True if the SQL text contains a destructive keyword
|
|
16
|
+
(DROP, TRUNCATE or DELETE).
|
|
17
|
+
|
|
18
|
+
>>> is_destructive("DROP TABLE users")
|
|
19
|
+
True
|
|
20
|
+
>>> is_destructive("SELECT * FROM users")
|
|
21
|
+
False
|
|
22
|
+
"""
|
|
23
|
+
return any(
|
|
24
|
+
word.upper() in _DESTRUCTIVE_KEYWORDS for word in re.split(r"[^A-Za-z0-9_]+", sql)
|
|
25
|
+
)
|
|
File without changes
|