Skip to content

Commit ac3a4b2

Browse files
feat: remove dj.kill and dj.kill_quick
Remove database connection management functions that don't belong in a data pipeline library. Closes #1347 Reasoning: - Outside DataJoint's scope (data pipelines, not DB administration) - Better tools exist (native SQL, CLI tools, GUIs, cloud consoles) - Implementation had issues (interactive prompts, SQL injection risk) - MySQL-only, wouldn't work with PostgreSQL backend Users can use native database tools instead: - MySQL: SHOW PROCESSLIST; KILL <pid>; - PostgreSQL: SELECT * FROM pg_stat_activity; SELECT pg_terminate_backend(pid); Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a5ddd03 commit ac3a4b2

3 files changed

Lines changed: 0 additions & 124 deletions

File tree

src/datajoint/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"Top",
4040
"U",
4141
"Diagram",
42-
"kill",
4342
"MatCell",
4443
"MatStruct",
4544
# Codec API
@@ -94,8 +93,6 @@
9493
# Diagram imports networkx and matplotlib
9594
"Diagram": (".diagram", "Diagram"),
9695
"diagram": (".diagram", None), # Return the module itself
97-
# kill imports pymysql via connection
98-
"kill": (".admin", "kill"),
9996
# cli imports click
10097
"cli": (".cli", "cli"),
10198
}

src/datajoint/admin.py

Lines changed: 0 additions & 101 deletions
This file was deleted.

tests/unit/test_lazy_imports.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@ def test_lazy_diagram_import():
2727
assert Diagram.__name__ == "Diagram"
2828

2929

30-
def test_lazy_admin_import():
31-
"""Admin module should not be loaded until dj.kill is accessed."""
32-
# Remove datajoint from sys.modules to get fresh import
33-
modules_to_remove = [key for key in sys.modules if key.startswith("datajoint")]
34-
for mod in modules_to_remove:
35-
del sys.modules[mod]
36-
37-
# Import datajoint
38-
import datajoint as dj
39-
40-
# Admin module should not be loaded yet
41-
assert "datajoint.admin" not in sys.modules, "admin module loaded eagerly"
42-
43-
# Access kill - should trigger lazy load
44-
kill = dj.kill
45-
assert "datajoint.admin" in sys.modules, "admin module not loaded after access"
46-
assert callable(kill)
47-
48-
4930
def test_lazy_cli_import():
5031
"""CLI module should not be loaded until dj.cli is accessed."""
5132
# Remove datajoint from sys.modules to get fresh import
@@ -103,5 +84,4 @@ def test_core_imports_available():
10384

10485
# Heavy modules should still not be loaded
10586
assert "datajoint.diagram" not in sys.modules
106-
assert "datajoint.admin" not in sys.modules
10787
assert "datajoint.cli" not in sys.modules

0 commit comments

Comments
 (0)