py-dbms-cli 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.
- py_dbms_cli-1.0/LICENSE +11 -0
- py_dbms_cli-1.0/MANIFEST.in +3 -0
- py_dbms_cli-1.0/PKG-INFO +145 -0
- py_dbms_cli-1.0/README.md +116 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/PKG-INFO +145 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/SOURCES.txt +16 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/dependency_links.txt +1 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/entry_points.txt +2 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/requires.txt +5 -0
- py_dbms_cli-1.0/py_dbms_cli.egg-info/top_level.txt +1 -0
- py_dbms_cli-1.0/pydbms/Global.py +23 -0
- py_dbms_cli-1.0/pydbms/__init__.py +1 -0
- py_dbms_cli-1.0/pydbms/cli.py +4 -0
- py_dbms_cli-1.0/pydbms/core.py +190 -0
- py_dbms_cli-1.0/pydbms/dependencies.py +16 -0
- py_dbms_cli-1.0/pydbms/pydbms_mysql.py +153 -0
- py_dbms_cli-1.0/pyproject.toml +30 -0
- py_dbms_cli-1.0/setup.cfg +4 -0
py_dbms_cli-1.0/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2025 Anish Sethi
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
py_dbms_cli-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-dbms-cli
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: A modern, secure, aesthetic and your ultimate DBMS client supporting MySQL and more.
|
|
5
|
+
Author-email: Anish Sethi <sethi.dynasty123@gmail.com>
|
|
6
|
+
License: Copyright 2025 Anish Sethi
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
|
+
Project-URL: Homepage, https://github.com/Anish-Sethi-12122/py-dbms-cli
|
|
18
|
+
Project-URL: Source, https://github.com/Anish-Sethi-12122/py-dbms-cli
|
|
19
|
+
Project-URL: Issues, https://github.com/Anish-Sethi-12122/py-dbms-cli/issues
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mysql-connector-python
|
|
24
|
+
Requires-Dist: rich
|
|
25
|
+
Requires-Dist: pyfiglet
|
|
26
|
+
Requires-Dist: sqlparse
|
|
27
|
+
Requires-Dist: pwinput
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
PY DBMS — A Modern, Secure, All-in-One DBMS CLI Client
|
|
31
|
+
|
|
32
|
+
PY DBMS is a lightweight, secure, and modern command-line database client built using Python.
|
|
33
|
+
It provides a clean user experience, readable output formatting, and convenient helper commands while connecting to MySQL.
|
|
34
|
+
|
|
35
|
+
This tool is designed for developers who prefer the terminal but want a more enhanced experience than the default MySQL CLI.
|
|
36
|
+
|
|
37
|
+
Features
|
|
38
|
+
Visual & UI
|
|
39
|
+
|
|
40
|
+
Rich-based terminal interface for clean, formatted output
|
|
41
|
+
|
|
42
|
+
Typewriter-style text rendering
|
|
43
|
+
|
|
44
|
+
ASCII banner and structured dashboard
|
|
45
|
+
|
|
46
|
+
Tabular display for query results
|
|
47
|
+
|
|
48
|
+
Password masking during login
|
|
49
|
+
|
|
50
|
+
Functional
|
|
51
|
+
|
|
52
|
+
Multi-line SQL query support
|
|
53
|
+
|
|
54
|
+
Built-in meta commands (.help, .tables, .schema, .version, etc.)
|
|
55
|
+
|
|
56
|
+
Execution time for SELECT queries
|
|
57
|
+
|
|
58
|
+
Graceful error handling (no session crashes)
|
|
59
|
+
|
|
60
|
+
Security
|
|
61
|
+
|
|
62
|
+
Secure password input using masked characters
|
|
63
|
+
|
|
64
|
+
Localhost defaults for safe development usage
|
|
65
|
+
|
|
66
|
+
Installation
|
|
67
|
+
|
|
68
|
+
Prerequisites
|
|
69
|
+
|
|
70
|
+
Python (3.10 or newer recommended)
|
|
71
|
+
|
|
72
|
+
A running MySQL Server
|
|
73
|
+
|
|
74
|
+
Install using pip:
|
|
75
|
+
|
|
76
|
+
pip install py-dbms-cli
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
All required dependencies are installed automatically.
|
|
80
|
+
|
|
81
|
+
Usage
|
|
82
|
+
|
|
83
|
+
1. Start the CLI
|
|
84
|
+
pydbms
|
|
85
|
+
|
|
86
|
+
2. Enter MySQL login credentials
|
|
87
|
+
|
|
88
|
+
You will be prompted for:
|
|
89
|
+
|
|
90
|
+
Host
|
|
91
|
+
|
|
92
|
+
Username
|
|
93
|
+
|
|
94
|
+
Password (masked using *)
|
|
95
|
+
|
|
96
|
+
3. Begin querying
|
|
97
|
+
|
|
98
|
+
Enter SQL commands as you normally would. The client supports multi-line queries and executes them once terminated with a ;.
|
|
99
|
+
|
|
100
|
+
Query Support
|
|
101
|
+
|
|
102
|
+
Standard SQL queries
|
|
103
|
+
|
|
104
|
+
Multi-line input
|
|
105
|
+
|
|
106
|
+
Separate behaviors for SELECT vs UPDATE/INSERT
|
|
107
|
+
|
|
108
|
+
MySQL-style syntax
|
|
109
|
+
|
|
110
|
+
Meta Commands
|
|
111
|
+
|
|
112
|
+
The tool includes additional helper commands:
|
|
113
|
+
|
|
114
|
+
Command Description
|
|
115
|
+
.help Show all helper commands
|
|
116
|
+
.databases List all databases
|
|
117
|
+
.tables List tables in the current database
|
|
118
|
+
.schema <table> Show CREATE TABLE definition
|
|
119
|
+
.clear Clear the screen
|
|
120
|
+
.version Show build/version info
|
|
121
|
+
.exit Exit the CLI
|
|
122
|
+
|
|
123
|
+
Roadmap
|
|
124
|
+
|
|
125
|
+
Future planned features include:
|
|
126
|
+
|
|
127
|
+
User profile support with encrypted JSON storage
|
|
128
|
+
|
|
129
|
+
Support for additional database engines (Oracle, MongoDB, etc.)
|
|
130
|
+
|
|
131
|
+
Consistent UI formatting across engines
|
|
132
|
+
|
|
133
|
+
Exportable session history
|
|
134
|
+
|
|
135
|
+
Customizable UI themes
|
|
136
|
+
|
|
137
|
+
Author
|
|
138
|
+
|
|
139
|
+
Anish Sethi
|
|
140
|
+
B.Tech Computer Science & Engineering
|
|
141
|
+
Delhi Technological University (Class of 2029)
|
|
142
|
+
|
|
143
|
+
License
|
|
144
|
+
|
|
145
|
+
This project is licensed under the BSD 3-Clause License.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
PY DBMS — A Modern, Secure, All-in-One DBMS CLI Client
|
|
2
|
+
|
|
3
|
+
PY DBMS is a lightweight, secure, and modern command-line database client built using Python.
|
|
4
|
+
It provides a clean user experience, readable output formatting, and convenient helper commands while connecting to MySQL.
|
|
5
|
+
|
|
6
|
+
This tool is designed for developers who prefer the terminal but want a more enhanced experience than the default MySQL CLI.
|
|
7
|
+
|
|
8
|
+
Features
|
|
9
|
+
Visual & UI
|
|
10
|
+
|
|
11
|
+
Rich-based terminal interface for clean, formatted output
|
|
12
|
+
|
|
13
|
+
Typewriter-style text rendering
|
|
14
|
+
|
|
15
|
+
ASCII banner and structured dashboard
|
|
16
|
+
|
|
17
|
+
Tabular display for query results
|
|
18
|
+
|
|
19
|
+
Password masking during login
|
|
20
|
+
|
|
21
|
+
Functional
|
|
22
|
+
|
|
23
|
+
Multi-line SQL query support
|
|
24
|
+
|
|
25
|
+
Built-in meta commands (.help, .tables, .schema, .version, etc.)
|
|
26
|
+
|
|
27
|
+
Execution time for SELECT queries
|
|
28
|
+
|
|
29
|
+
Graceful error handling (no session crashes)
|
|
30
|
+
|
|
31
|
+
Security
|
|
32
|
+
|
|
33
|
+
Secure password input using masked characters
|
|
34
|
+
|
|
35
|
+
Localhost defaults for safe development usage
|
|
36
|
+
|
|
37
|
+
Installation
|
|
38
|
+
|
|
39
|
+
Prerequisites
|
|
40
|
+
|
|
41
|
+
Python (3.10 or newer recommended)
|
|
42
|
+
|
|
43
|
+
A running MySQL Server
|
|
44
|
+
|
|
45
|
+
Install using pip:
|
|
46
|
+
|
|
47
|
+
pip install py-dbms-cli
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
All required dependencies are installed automatically.
|
|
51
|
+
|
|
52
|
+
Usage
|
|
53
|
+
|
|
54
|
+
1. Start the CLI
|
|
55
|
+
pydbms
|
|
56
|
+
|
|
57
|
+
2. Enter MySQL login credentials
|
|
58
|
+
|
|
59
|
+
You will be prompted for:
|
|
60
|
+
|
|
61
|
+
Host
|
|
62
|
+
|
|
63
|
+
Username
|
|
64
|
+
|
|
65
|
+
Password (masked using *)
|
|
66
|
+
|
|
67
|
+
3. Begin querying
|
|
68
|
+
|
|
69
|
+
Enter SQL commands as you normally would. The client supports multi-line queries and executes them once terminated with a ;.
|
|
70
|
+
|
|
71
|
+
Query Support
|
|
72
|
+
|
|
73
|
+
Standard SQL queries
|
|
74
|
+
|
|
75
|
+
Multi-line input
|
|
76
|
+
|
|
77
|
+
Separate behaviors for SELECT vs UPDATE/INSERT
|
|
78
|
+
|
|
79
|
+
MySQL-style syntax
|
|
80
|
+
|
|
81
|
+
Meta Commands
|
|
82
|
+
|
|
83
|
+
The tool includes additional helper commands:
|
|
84
|
+
|
|
85
|
+
Command Description
|
|
86
|
+
.help Show all helper commands
|
|
87
|
+
.databases List all databases
|
|
88
|
+
.tables List tables in the current database
|
|
89
|
+
.schema <table> Show CREATE TABLE definition
|
|
90
|
+
.clear Clear the screen
|
|
91
|
+
.version Show build/version info
|
|
92
|
+
.exit Exit the CLI
|
|
93
|
+
|
|
94
|
+
Roadmap
|
|
95
|
+
|
|
96
|
+
Future planned features include:
|
|
97
|
+
|
|
98
|
+
User profile support with encrypted JSON storage
|
|
99
|
+
|
|
100
|
+
Support for additional database engines (Oracle, MongoDB, etc.)
|
|
101
|
+
|
|
102
|
+
Consistent UI formatting across engines
|
|
103
|
+
|
|
104
|
+
Exportable session history
|
|
105
|
+
|
|
106
|
+
Customizable UI themes
|
|
107
|
+
|
|
108
|
+
Author
|
|
109
|
+
|
|
110
|
+
Anish Sethi
|
|
111
|
+
B.Tech Computer Science & Engineering
|
|
112
|
+
Delhi Technological University (Class of 2029)
|
|
113
|
+
|
|
114
|
+
License
|
|
115
|
+
|
|
116
|
+
This project is licensed under the BSD 3-Clause License.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-dbms-cli
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: A modern, secure, aesthetic and your ultimate DBMS client supporting MySQL and more.
|
|
5
|
+
Author-email: Anish Sethi <sethi.dynasty123@gmail.com>
|
|
6
|
+
License: Copyright 2025 Anish Sethi
|
|
7
|
+
|
|
8
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
17
|
+
Project-URL: Homepage, https://github.com/Anish-Sethi-12122/py-dbms-cli
|
|
18
|
+
Project-URL: Source, https://github.com/Anish-Sethi-12122/py-dbms-cli
|
|
19
|
+
Project-URL: Issues, https://github.com/Anish-Sethi-12122/py-dbms-cli/issues
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mysql-connector-python
|
|
24
|
+
Requires-Dist: rich
|
|
25
|
+
Requires-Dist: pyfiglet
|
|
26
|
+
Requires-Dist: sqlparse
|
|
27
|
+
Requires-Dist: pwinput
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
PY DBMS — A Modern, Secure, All-in-One DBMS CLI Client
|
|
31
|
+
|
|
32
|
+
PY DBMS is a lightweight, secure, and modern command-line database client built using Python.
|
|
33
|
+
It provides a clean user experience, readable output formatting, and convenient helper commands while connecting to MySQL.
|
|
34
|
+
|
|
35
|
+
This tool is designed for developers who prefer the terminal but want a more enhanced experience than the default MySQL CLI.
|
|
36
|
+
|
|
37
|
+
Features
|
|
38
|
+
Visual & UI
|
|
39
|
+
|
|
40
|
+
Rich-based terminal interface for clean, formatted output
|
|
41
|
+
|
|
42
|
+
Typewriter-style text rendering
|
|
43
|
+
|
|
44
|
+
ASCII banner and structured dashboard
|
|
45
|
+
|
|
46
|
+
Tabular display for query results
|
|
47
|
+
|
|
48
|
+
Password masking during login
|
|
49
|
+
|
|
50
|
+
Functional
|
|
51
|
+
|
|
52
|
+
Multi-line SQL query support
|
|
53
|
+
|
|
54
|
+
Built-in meta commands (.help, .tables, .schema, .version, etc.)
|
|
55
|
+
|
|
56
|
+
Execution time for SELECT queries
|
|
57
|
+
|
|
58
|
+
Graceful error handling (no session crashes)
|
|
59
|
+
|
|
60
|
+
Security
|
|
61
|
+
|
|
62
|
+
Secure password input using masked characters
|
|
63
|
+
|
|
64
|
+
Localhost defaults for safe development usage
|
|
65
|
+
|
|
66
|
+
Installation
|
|
67
|
+
|
|
68
|
+
Prerequisites
|
|
69
|
+
|
|
70
|
+
Python (3.10 or newer recommended)
|
|
71
|
+
|
|
72
|
+
A running MySQL Server
|
|
73
|
+
|
|
74
|
+
Install using pip:
|
|
75
|
+
|
|
76
|
+
pip install py-dbms-cli
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
All required dependencies are installed automatically.
|
|
80
|
+
|
|
81
|
+
Usage
|
|
82
|
+
|
|
83
|
+
1. Start the CLI
|
|
84
|
+
pydbms
|
|
85
|
+
|
|
86
|
+
2. Enter MySQL login credentials
|
|
87
|
+
|
|
88
|
+
You will be prompted for:
|
|
89
|
+
|
|
90
|
+
Host
|
|
91
|
+
|
|
92
|
+
Username
|
|
93
|
+
|
|
94
|
+
Password (masked using *)
|
|
95
|
+
|
|
96
|
+
3. Begin querying
|
|
97
|
+
|
|
98
|
+
Enter SQL commands as you normally would. The client supports multi-line queries and executes them once terminated with a ;.
|
|
99
|
+
|
|
100
|
+
Query Support
|
|
101
|
+
|
|
102
|
+
Standard SQL queries
|
|
103
|
+
|
|
104
|
+
Multi-line input
|
|
105
|
+
|
|
106
|
+
Separate behaviors for SELECT vs UPDATE/INSERT
|
|
107
|
+
|
|
108
|
+
MySQL-style syntax
|
|
109
|
+
|
|
110
|
+
Meta Commands
|
|
111
|
+
|
|
112
|
+
The tool includes additional helper commands:
|
|
113
|
+
|
|
114
|
+
Command Description
|
|
115
|
+
.help Show all helper commands
|
|
116
|
+
.databases List all databases
|
|
117
|
+
.tables List tables in the current database
|
|
118
|
+
.schema <table> Show CREATE TABLE definition
|
|
119
|
+
.clear Clear the screen
|
|
120
|
+
.version Show build/version info
|
|
121
|
+
.exit Exit the CLI
|
|
122
|
+
|
|
123
|
+
Roadmap
|
|
124
|
+
|
|
125
|
+
Future planned features include:
|
|
126
|
+
|
|
127
|
+
User profile support with encrypted JSON storage
|
|
128
|
+
|
|
129
|
+
Support for additional database engines (Oracle, MongoDB, etc.)
|
|
130
|
+
|
|
131
|
+
Consistent UI formatting across engines
|
|
132
|
+
|
|
133
|
+
Exportable session history
|
|
134
|
+
|
|
135
|
+
Customizable UI themes
|
|
136
|
+
|
|
137
|
+
Author
|
|
138
|
+
|
|
139
|
+
Anish Sethi
|
|
140
|
+
B.Tech Computer Science & Engineering
|
|
141
|
+
Delhi Technological University (Class of 2029)
|
|
142
|
+
|
|
143
|
+
License
|
|
144
|
+
|
|
145
|
+
This project is licensed under the BSD 3-Clause License.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
py_dbms_cli.egg-info/PKG-INFO
|
|
6
|
+
py_dbms_cli.egg-info/SOURCES.txt
|
|
7
|
+
py_dbms_cli.egg-info/dependency_links.txt
|
|
8
|
+
py_dbms_cli.egg-info/entry_points.txt
|
|
9
|
+
py_dbms_cli.egg-info/requires.txt
|
|
10
|
+
py_dbms_cli.egg-info/top_level.txt
|
|
11
|
+
pydbms/Global.py
|
|
12
|
+
pydbms/__init__.py
|
|
13
|
+
pydbms/cli.py
|
|
14
|
+
pydbms/core.py
|
|
15
|
+
pydbms/dependencies.py
|
|
16
|
+
pydbms/pydbms_mysql.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pydbms
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#Global functions and variables used across all/major files
|
|
2
|
+
|
|
3
|
+
from .dependencies import Console, time
|
|
4
|
+
|
|
5
|
+
console=Console()
|
|
6
|
+
|
|
7
|
+
def Print(message, color_key="WHITE", style="", type=True):
|
|
8
|
+
COLOR_MAP = {
|
|
9
|
+
"CYAN": "bright_cyan",
|
|
10
|
+
"YELLOW": "bright_yellow",
|
|
11
|
+
"RED": "bright_red",
|
|
12
|
+
"GREEN": "bright_green",
|
|
13
|
+
"WHITE": "white",
|
|
14
|
+
"MAGENTA": "bright_magenta"
|
|
15
|
+
}
|
|
16
|
+
color = COLOR_MAP.get(color_key, "white")
|
|
17
|
+
delay = 0.02069 if type else 0
|
|
18
|
+
for char in message:
|
|
19
|
+
if char == "\n":
|
|
20
|
+
console.print()
|
|
21
|
+
continue
|
|
22
|
+
console.print(char, style=f"{style} {color}", end="")
|
|
23
|
+
time.sleep(delay)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# PY DBMS is a CLI-only package. Not intended for direct import.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
'''
|
|
2
|
+
PY DBMS — DB client CLI
|
|
3
|
+
Copyright (C) 2025 Anish Sethi
|
|
4
|
+
Licensed under - BSD-3-Clause License
|
|
5
|
+
'''
|
|
6
|
+
|
|
7
|
+
from .Global import Print, console
|
|
8
|
+
from .dependencies import pyfiglet, Text, Table, Align, Rule, Panel, mysql, sys
|
|
9
|
+
from .pydbms_mysql import execute, execute_change, execute_select, connect, get_query_mysql
|
|
10
|
+
|
|
11
|
+
def print_banner():
|
|
12
|
+
ascii_art = pyfiglet.figlet_format("PY DBMS", font="slant").rstrip()
|
|
13
|
+
|
|
14
|
+
logo = Text(ascii_art, style="bold color(57)")
|
|
15
|
+
|
|
16
|
+
stats_table = Table(show_header=False, box=None, expand=True)
|
|
17
|
+
stats_table.add_column("1", justify="center", ratio=1)
|
|
18
|
+
stats_table.add_column("2", justify="center", ratio=1)
|
|
19
|
+
stats_table.add_column("3", justify="center", ratio=1)
|
|
20
|
+
|
|
21
|
+
stats_table.add_row(
|
|
22
|
+
"[bold cyan]v1.0[/]\n [bold white]Version[/]",
|
|
23
|
+
"[bold yellow]MySQL[/]\n[bold white]Currently Supported[/]",
|
|
24
|
+
"[bold green]Online since 2025[/]\n[bold white]Status[/]"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
author = Text("Anish Sethi • Delhi Technological University", style="bright_white")
|
|
28
|
+
|
|
29
|
+
License = Text("Licensed Under BSD-3-Clause License (see .version for more info)", style="dim white")
|
|
30
|
+
|
|
31
|
+
content = [
|
|
32
|
+
Align(logo, align="center"),
|
|
33
|
+
Text("\n"),
|
|
34
|
+
Rule(style="dim purple"),
|
|
35
|
+
Text("\n"),
|
|
36
|
+
stats_table,
|
|
37
|
+
Text("\n"),
|
|
38
|
+
Align(author, align="center"),
|
|
39
|
+
Align(License, align="center"),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
from rich.console import Group
|
|
43
|
+
panel_content = Group(*content)
|
|
44
|
+
|
|
45
|
+
console.print(
|
|
46
|
+
Panel(
|
|
47
|
+
panel_content,
|
|
48
|
+
border_style="color(57)",
|
|
49
|
+
title="[bold white] SECURE TERMINAL [/]",
|
|
50
|
+
title_align="center",
|
|
51
|
+
padding=(1, 2),
|
|
52
|
+
expand=True
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
print('\n\n')
|
|
56
|
+
|
|
57
|
+
def meta(cmd, cur):
|
|
58
|
+
cmd = cmd.strip()
|
|
59
|
+
|
|
60
|
+
# .help
|
|
61
|
+
if cmd == ".help":
|
|
62
|
+
help_table = Table(title="Helper Commands", show_header=False, header_style="bold cyan")
|
|
63
|
+
help_table.add_column("Command", no_wrap=True)
|
|
64
|
+
help_table.add_column("Description", style="white", no_wrap=True)
|
|
65
|
+
help_table.add_row(".help", "Show helper commands")
|
|
66
|
+
help_table.add_row(".databases", "Show databases in current connection")
|
|
67
|
+
help_table.add_row(".tables", "Show tables in current database")
|
|
68
|
+
help_table.add_row(".schema <table>", "Show CREATE TABLE statement for table <table>")
|
|
69
|
+
help_table.add_row(".clear", "Clear the terminal screen")
|
|
70
|
+
help_table.add_row(".version", "Show pydbms build information")
|
|
71
|
+
help_table.add_row(".exit", "Exit pydbms")
|
|
72
|
+
console.print(help_table)
|
|
73
|
+
console.print()
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
# .databases
|
|
77
|
+
if cmd == ".databases":
|
|
78
|
+
try:
|
|
79
|
+
execute_select("SHOW DATABASES;",cur)
|
|
80
|
+
except mysql.Error as err:
|
|
81
|
+
Print(err.msg, "RED", "bold")
|
|
82
|
+
return
|
|
83
|
+
|
|
84
|
+
# .tables
|
|
85
|
+
if cmd == ".tables":
|
|
86
|
+
try:
|
|
87
|
+
execute_select("SHOW TABLES;",cur)
|
|
88
|
+
except mysql.Error as err:
|
|
89
|
+
Print(err.msg, "RED", "bold")
|
|
90
|
+
return
|
|
91
|
+
|
|
92
|
+
# .schema table_name
|
|
93
|
+
if cmd.startswith(".schema"):
|
|
94
|
+
parts = cmd.split()
|
|
95
|
+
if len(parts) != 2:
|
|
96
|
+
print("Usage: .schema <table_name>\n")
|
|
97
|
+
return
|
|
98
|
+
table = parts[1]
|
|
99
|
+
try:
|
|
100
|
+
cur.execute(f"SHOW CREATE TABLE {table};")
|
|
101
|
+
row = cur.fetchone()
|
|
102
|
+
if row:
|
|
103
|
+
print(row[1])
|
|
104
|
+
print()
|
|
105
|
+
else:
|
|
106
|
+
print(f"No such table: {table}\n")
|
|
107
|
+
except mysql.Error as err:
|
|
108
|
+
print(err.msg)
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
# .clear
|
|
112
|
+
if cmd == ".clear":
|
|
113
|
+
import os
|
|
114
|
+
os.system("cls" if os.name == "nt" else "clear")
|
|
115
|
+
print()
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
# .version
|
|
119
|
+
if cmd == ".version":
|
|
120
|
+
console.print()
|
|
121
|
+
info = Table(show_header=False, box=None)
|
|
122
|
+
info.add_column("", style="white", no_wrap=True)
|
|
123
|
+
info.add_column("", style="dim white")
|
|
124
|
+
|
|
125
|
+
info.add_row("Name", "[link=https://github.com/Anish-Sethi-12122/py-dbms-cli]pydbms Terminal[/link]")
|
|
126
|
+
info.add_row("Version", "v1.0")
|
|
127
|
+
info.add_row("Build", "Stable Release")
|
|
128
|
+
info.add_row("Python", f"[link=https://www.python.org/]{sys.version.split()[0]}[/link]")
|
|
129
|
+
info.add_row("Author", "[link=https://www.linkedin.com/in/anish-sethi-dtu-cse/]Anish Sethi[/link]")
|
|
130
|
+
info.add_row("Institution", "B.Tech Computer Science and Engineering @ Delhi Technological University")
|
|
131
|
+
info.add_row("Licensed under", "[link=https://opensource.org/license/bsd-3-clause]BSD-3-Clause License[/link]")
|
|
132
|
+
|
|
133
|
+
console.print(
|
|
134
|
+
Panel(
|
|
135
|
+
info,
|
|
136
|
+
title="[bold white]PYSQL Terminal — Build Info[/]",
|
|
137
|
+
border_style="bright_magenta",
|
|
138
|
+
padding=(1, 2),
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
console.print()
|
|
142
|
+
return
|
|
143
|
+
|
|
144
|
+
# .exit
|
|
145
|
+
if cmd == ".exit":
|
|
146
|
+
Print("Session Terminated.", "RED", "bold")
|
|
147
|
+
sys.exit()
|
|
148
|
+
|
|
149
|
+
print(f"Unknown command: {cmd}\nCheck your manual that corresponds to helper commands.")
|
|
150
|
+
|
|
151
|
+
def main():
|
|
152
|
+
print_banner()
|
|
153
|
+
con,cur=connect()
|
|
154
|
+
|
|
155
|
+
Print("Welcome to PY DBMS. If you are unsure where to start, here are some helper commands.", "YELLOW")
|
|
156
|
+
print("\n\n")
|
|
157
|
+
meta(".help",cur)
|
|
158
|
+
|
|
159
|
+
while True:
|
|
160
|
+
query=get_query_mysql()
|
|
161
|
+
|
|
162
|
+
if query.strip().startswith("."):
|
|
163
|
+
meta(query.strip(), cur)
|
|
164
|
+
continue
|
|
165
|
+
|
|
166
|
+
if query.lower().strip()=="exit;":
|
|
167
|
+
Print("Session Terminated.", "RED", "bold")
|
|
168
|
+
sys.exit()
|
|
169
|
+
|
|
170
|
+
q = query.lower().strip()
|
|
171
|
+
if q.startswith(("select","with","desc","describe","show")):
|
|
172
|
+
try:
|
|
173
|
+
execute_select(query, cur)
|
|
174
|
+
except mysql.Error as err:
|
|
175
|
+
console.print(f"{err.msg}", style="bold red")
|
|
176
|
+
|
|
177
|
+
elif q.startswith(("update","delete","insert","drop")):
|
|
178
|
+
try:
|
|
179
|
+
execute_change(query,con,cur)
|
|
180
|
+
except mysql.Error as err:
|
|
181
|
+
console.print(f"{err.msg}",style="bold red")
|
|
182
|
+
|
|
183
|
+
else:
|
|
184
|
+
try:
|
|
185
|
+
execute(query,cur)
|
|
186
|
+
except mysql.Error as err:
|
|
187
|
+
console.print(f"{err.msg}",style="bold red")
|
|
188
|
+
|
|
189
|
+
if __name__=="__main__":
|
|
190
|
+
main()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#Dependencies imports
|
|
2
|
+
|
|
3
|
+
import mysql.connector as mysql
|
|
4
|
+
import sqlparse
|
|
5
|
+
import pwinput
|
|
6
|
+
import time
|
|
7
|
+
import sys
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.text import Text
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
from rich import box
|
|
12
|
+
import pyfiglet
|
|
13
|
+
from rich.table import Table
|
|
14
|
+
from rich.align import Align
|
|
15
|
+
from rich.rule import Rule
|
|
16
|
+
import re
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#Instance MySQL
|
|
2
|
+
|
|
3
|
+
from .dependencies import mysql, pwinput, sys, time, sqlparse, Panel, Table, re, box
|
|
4
|
+
from .Global import Print, console
|
|
5
|
+
|
|
6
|
+
def connect():
|
|
7
|
+
try:
|
|
8
|
+
host="localhost"
|
|
9
|
+
user="root"
|
|
10
|
+
Print(f"pydbms> Enter host name for MySQL (default value -> {host}):", "YELLOW")
|
|
11
|
+
host=input()
|
|
12
|
+
if not host:
|
|
13
|
+
host="localhost"
|
|
14
|
+
Print(f"pydbms> Enter user name for MySQL (default value -> {user}):", "YELLOW")
|
|
15
|
+
user=input()
|
|
16
|
+
if not user:
|
|
17
|
+
user="root"
|
|
18
|
+
Pas=pwinput.pwinput(prompt='pydbms> Enter password: ', mask='*')
|
|
19
|
+
except KeyboardInterrupt:
|
|
20
|
+
Print("Invalid", "RED", "bold")
|
|
21
|
+
sys.exit()
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
con = mysql.connect(host=host, user=user, passwd=Pas)
|
|
25
|
+
cur = con.cursor()
|
|
26
|
+
Print("✅ Login successful.\nSuccessfully connected to MySQL\n\n","GREEN")
|
|
27
|
+
return con,cur
|
|
28
|
+
except mysql.Error:
|
|
29
|
+
Print("❌ Login failed: Incorrect password entered\n", "RED", "bold")
|
|
30
|
+
sys.exit()
|
|
31
|
+
return -1
|
|
32
|
+
|
|
33
|
+
def execute_select(query,cur):
|
|
34
|
+
start = time.time()
|
|
35
|
+
cur.execute(query)
|
|
36
|
+
end = time.time()
|
|
37
|
+
result=cur.fetchall()
|
|
38
|
+
columns = [desc[0] for desc in cur.description]
|
|
39
|
+
console.print()
|
|
40
|
+
|
|
41
|
+
result_table = Table(show_header=True, box=box.SIMPLE_HEAVY, padding=(0,1))
|
|
42
|
+
|
|
43
|
+
for i in columns:
|
|
44
|
+
result_table.add_column(i, style="white", no_wrap=True)
|
|
45
|
+
|
|
46
|
+
for row in result:
|
|
47
|
+
row_row = []
|
|
48
|
+
for x in row:
|
|
49
|
+
if x is None:
|
|
50
|
+
row_row.append("[dim white]NULL[/]")
|
|
51
|
+
else:
|
|
52
|
+
row_row.append(str(x))
|
|
53
|
+
result_table.add_row(*row_row)
|
|
54
|
+
|
|
55
|
+
title = get_query_title(query)
|
|
56
|
+
|
|
57
|
+
console.print(
|
|
58
|
+
Panel(
|
|
59
|
+
result_table,
|
|
60
|
+
title=title,
|
|
61
|
+
border_style="bright_magenta",
|
|
62
|
+
padding=(1, 2),
|
|
63
|
+
expand=False
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
console.print()
|
|
67
|
+
console.print(f"Query executed in {end-start:.3f}sec")
|
|
68
|
+
console.print()
|
|
69
|
+
|
|
70
|
+
def execute_change(query,con,cur):
|
|
71
|
+
cur.execute(query)
|
|
72
|
+
Print("Query executed with no flags.", "GREEN")
|
|
73
|
+
console.print()
|
|
74
|
+
con.commit()
|
|
75
|
+
|
|
76
|
+
def execute(query,cur):
|
|
77
|
+
cur.execute(query)
|
|
78
|
+
Print("Query executed with no flags.", "GREEN")
|
|
79
|
+
console.print()
|
|
80
|
+
|
|
81
|
+
def get_query_mysql():
|
|
82
|
+
try:
|
|
83
|
+
buffer = ""
|
|
84
|
+
while True:
|
|
85
|
+
line = input("pydbms> " if buffer == "" else " ")
|
|
86
|
+
buffer += line + "\n"
|
|
87
|
+
if buffer.strip().startswith("."):
|
|
88
|
+
break
|
|
89
|
+
statements = sqlparse.parse(buffer)
|
|
90
|
+
if statements and buffer.strip().endswith(";"):
|
|
91
|
+
break
|
|
92
|
+
query = buffer
|
|
93
|
+
|
|
94
|
+
except KeyboardInterrupt:
|
|
95
|
+
Print("Invalid", "RED", "bold")
|
|
96
|
+
|
|
97
|
+
console.print()
|
|
98
|
+
return query
|
|
99
|
+
|
|
100
|
+
def get_query_title(query):
|
|
101
|
+
q = query.strip().lower()
|
|
102
|
+
|
|
103
|
+
# === Simple SELECT ===
|
|
104
|
+
if q.startswith("select"):
|
|
105
|
+
m = re.search(r"from\s+`?([a-zA-Z0-9_]+)`?", q)
|
|
106
|
+
return m.group(1) if m else "Query Result"
|
|
107
|
+
|
|
108
|
+
# === EXPLAIN ===
|
|
109
|
+
if q.startswith("explain analyze"):
|
|
110
|
+
return "Execution Analysis"
|
|
111
|
+
if q.startswith("explain"):
|
|
112
|
+
return "Query Execution Plan"
|
|
113
|
+
|
|
114
|
+
# === DESCRIBE / SHOW COLUMNS ===
|
|
115
|
+
m = re.match(r"(describe|desc|show columns from)\s+([a-zA-Z0-9_]+)", q)
|
|
116
|
+
if m:
|
|
117
|
+
return f"Description for table {m.group(2)}"
|
|
118
|
+
|
|
119
|
+
# === SHOW CREATE ===
|
|
120
|
+
m = re.match(r"show create (\w+)\s+([a-zA-Z0-9_]+)", q)
|
|
121
|
+
if m:
|
|
122
|
+
kind, name = m.group(1), m.group(2)
|
|
123
|
+
return f"Create {kind.capitalize()}: {name}"
|
|
124
|
+
|
|
125
|
+
# === Generic SHOW commands ===
|
|
126
|
+
show_map = {
|
|
127
|
+
"show tables": "List of Tables in current database",
|
|
128
|
+
"show full tables": "List of Tables (Extended) in current database",
|
|
129
|
+
"show databases": "List of Databases in current connection",
|
|
130
|
+
"show schemas": "List of Databases",
|
|
131
|
+
"show triggers": "Triggers",
|
|
132
|
+
"show events": "Events",
|
|
133
|
+
"show plugins": "Plugins",
|
|
134
|
+
"show privileges": "Privileges",
|
|
135
|
+
"show processlist": "Process List",
|
|
136
|
+
"show engines": "Storage Engines",
|
|
137
|
+
"show character set": "Character Sets",
|
|
138
|
+
"show collation": "Collations",
|
|
139
|
+
"show variables": "Server Variables",
|
|
140
|
+
"show global status": "Global Status Variables",
|
|
141
|
+
"show session status": "Session Status Variables",
|
|
142
|
+
"show engine innodb status": "InnoDB Engine Status",
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
for key, title in show_map.items():
|
|
146
|
+
if q.startswith(key):
|
|
147
|
+
return title
|
|
148
|
+
|
|
149
|
+
# === HELP ===
|
|
150
|
+
if q.startswith("help"):
|
|
151
|
+
return f"Help: {query[4:].strip()}"
|
|
152
|
+
|
|
153
|
+
return "Query Result"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py-dbms-cli"
|
|
7
|
+
version = "1.0"
|
|
8
|
+
description = "A modern, secure, aesthetic and your ultimate DBMS client supporting MySQL and more."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Anish Sethi", email = "sethi.dynasty123@gmail.com" }
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
"mysql-connector-python",
|
|
18
|
+
"rich",
|
|
19
|
+
"pyfiglet",
|
|
20
|
+
"sqlparse",
|
|
21
|
+
"pwinput"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/Anish-Sethi-12122/py-dbms-cli"
|
|
26
|
+
Source = "https://github.com/Anish-Sethi-12122/py-dbms-cli"
|
|
27
|
+
Issues = "https://github.com/Anish-Sethi-12122/py-dbms-cli/issues"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
pydbms = "pydbms.cli:run"
|