vortex-cli 4.14.1__tar.gz → 4.15.1__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.
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/PKG-INFO +2 -1
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/README.md +1 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/setup.cfg +1 -1
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/cli.py +6 -2
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/db.py +22 -5
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/soap.py +5 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/workspace.py +2 -2
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/PKG-INFO +2 -1
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/LICENSE +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/setup.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/__init__.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/__main__.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/colour.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/__init__.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/clean.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/clone.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/code.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/config.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/copy.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/delete.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/docs.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/execute.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/find.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/grep.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/list.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/log.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/new.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/commands/watch.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/constants.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/docs/Blackbook.pdf +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/lib/puakma.jar +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/logging.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/main.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/models.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/spinner.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex/util.py +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/SOURCES.txt +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/dependency_links.txt +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/entry_points.txt +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/requires.txt +0 -0
- {vortex_cli-4.14.1 → vortex_cli-4.15.1}/vortex_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vortex_cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.15.1
|
|
4
4
|
Home-page: https://github.com/jordanamos/vortex-cli
|
|
5
5
|
Author: Jordan Amos
|
|
6
6
|
Author-email: jordan.amos@gmail.com
|
|
@@ -76,6 +76,7 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
76
76
|
puakma_db_conn_id = 13
|
|
77
77
|
username = myuser ; Optional - Prompted at runtime if not provided
|
|
78
78
|
password = mypassword ; Optional - Prompted at runtime if not provided
|
|
79
|
+
; Optional
|
|
79
80
|
lib_path = ; additional jars that should be included in the classpath
|
|
80
81
|
java_home = /usr/lib/jvm/java-17-openjdk-amd64/ ; The local path to the JRE to use. Should be the same version running on your server
|
|
81
82
|
java_environment_name = JavaSE-17 ; Java Execution Environment name https://docs.osgi.org/reference/eenames.html
|
|
@@ -54,6 +54,7 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
54
54
|
puakma_db_conn_id = 13
|
|
55
55
|
username = myuser ; Optional - Prompted at runtime if not provided
|
|
56
56
|
password = mypassword ; Optional - Prompted at runtime if not provided
|
|
57
|
+
; Optional
|
|
57
58
|
lib_path = ; additional jars that should be included in the classpath
|
|
58
59
|
java_home = /usr/lib/jvm/java-17-openjdk-amd64/ ; The local path to the JRE to use. Should be the same version running on your server
|
|
59
60
|
java_environment_name = JavaSE-17 ; Java Execution Environment name https://docs.osgi.org/reference/eenames.html
|
|
@@ -536,9 +536,13 @@ def add_db_parser(command_parser: _SubParsersAction[ArgumentParser]) -> Argument
|
|
|
536
536
|
db_mutex = db_parser.add_mutually_exclusive_group(required=True)
|
|
537
537
|
db_mutex.add_argument(
|
|
538
538
|
"--sql",
|
|
539
|
+
type=str,
|
|
540
|
+
nargs="?",
|
|
541
|
+
const="",
|
|
539
542
|
help=(
|
|
540
|
-
"
|
|
541
|
-
"Requires <database> to be a database connection id (int)."
|
|
543
|
+
"The SQL query to execute. "
|
|
544
|
+
"Requires <database> to be a database connection id (int). "
|
|
545
|
+
"Interactively prompts for the sql if the value is empty (Non Windows)."
|
|
542
546
|
),
|
|
543
547
|
)
|
|
544
548
|
db_mutex.add_argument(
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
import tempfile
|
|
4
8
|
from typing import Any
|
|
5
9
|
|
|
6
10
|
import tabulate
|
|
@@ -9,7 +13,6 @@ from vortex.models import DatabaseConnection
|
|
|
9
13
|
from vortex.models import PuakmaServer
|
|
10
14
|
from vortex.workspace import Workspace
|
|
11
15
|
|
|
12
|
-
|
|
13
16
|
logger = logging.getLogger("vortex")
|
|
14
17
|
|
|
15
18
|
GET_SCHEMA_SQL = """\
|
|
@@ -123,6 +126,17 @@ def _is_connection_cloned(workspace: Workspace, conn_id: int) -> bool:
|
|
|
123
126
|
return any(conn.id == conn_id for conn in conns)
|
|
124
127
|
|
|
125
128
|
|
|
129
|
+
def _read_from_editor() -> str:
|
|
130
|
+
fd, tmp_sql_file = tempfile.mkstemp(suffix=".sql")
|
|
131
|
+
os.close(fd)
|
|
132
|
+
try:
|
|
133
|
+
subprocess.call(["nano", tmp_sql_file])
|
|
134
|
+
with open(tmp_sql_file) as f:
|
|
135
|
+
return f.read().strip()
|
|
136
|
+
finally:
|
|
137
|
+
os.remove(tmp_sql_file)
|
|
138
|
+
|
|
139
|
+
|
|
126
140
|
def db(
|
|
127
141
|
workspace: Workspace,
|
|
128
142
|
server: PuakmaServer,
|
|
@@ -134,7 +148,9 @@ def db(
|
|
|
134
148
|
list_tables: bool = False,
|
|
135
149
|
truncate_cols: bool = False,
|
|
136
150
|
) -> int:
|
|
137
|
-
if sql:
|
|
151
|
+
if sql is not None:
|
|
152
|
+
if sql.strip() == "":
|
|
153
|
+
sql = None if sys.platform == "win32" else _read_from_editor()
|
|
138
154
|
db_name = None
|
|
139
155
|
conn_id = int(database)
|
|
140
156
|
# If we're modifying a database, lets check that its locally
|
|
@@ -142,7 +158,7 @@ def db(
|
|
|
142
158
|
if update and not _is_connection_cloned(workspace, conn_id):
|
|
143
159
|
logger.error(f"No cloned applications with DB Connection ID '{conn_id}'")
|
|
144
160
|
return 1
|
|
145
|
-
if not update:
|
|
161
|
+
if sql and not update:
|
|
146
162
|
sql = sql + f" LIMIT {limit_n_results}"
|
|
147
163
|
else:
|
|
148
164
|
db_name = str(database).lower()
|
|
@@ -154,8 +170,9 @@ def db(
|
|
|
154
170
|
elif list_tables:
|
|
155
171
|
sql = LIST_TABLES_SQL % db_name
|
|
156
172
|
|
|
157
|
-
if sql
|
|
158
|
-
|
|
173
|
+
if not sql:
|
|
174
|
+
logger.error("No Query to execute.")
|
|
175
|
+
return 1
|
|
159
176
|
|
|
160
177
|
return _output_result(
|
|
161
178
|
server, conn_id, sql, update, truncate_cols, db_name, schema_table, list_tables
|
|
@@ -318,6 +318,7 @@ class ServerDesigner(_PuakmaSOAPService):
|
|
|
318
318
|
def execute_command(self, command: str) -> str | None:
|
|
319
319
|
operation = "executeCommand"
|
|
320
320
|
params = [_SOAPParam("p1", command, _XSD_STRING)]
|
|
321
|
+
logger.debug(f"Executing command: {command}")
|
|
321
322
|
resp = self._post(operation, params)
|
|
322
323
|
return resp.text
|
|
323
324
|
|
|
@@ -338,6 +339,8 @@ class DatabaseDesigner(_PuakmaSOAPService):
|
|
|
338
339
|
_SOAPParam("p2", query, _XSD_STRING),
|
|
339
340
|
_SOAPParam("p3", is_update, _XSD_BOOLEAN),
|
|
340
341
|
]
|
|
342
|
+
logger.debug("Executing query")
|
|
343
|
+
logger.debug(query)
|
|
341
344
|
resp = await self._apost(operation, params)
|
|
342
345
|
col_lookup = [
|
|
343
346
|
meta_row.attrib["name"] for meta_row in resp.findall(".//metadata")
|
|
@@ -367,6 +370,8 @@ class DatabaseDesigner(_PuakmaSOAPService):
|
|
|
367
370
|
_SOAPParam("p2", query, _XSD_STRING),
|
|
368
371
|
_SOAPParam("p3", is_update, _XSD_BOOLEAN),
|
|
369
372
|
]
|
|
373
|
+
logger.debug("Executing query")
|
|
374
|
+
logger.debug(query)
|
|
370
375
|
resp = self._post(operation, params)
|
|
371
376
|
col_lookup = [
|
|
372
377
|
meta_row.attrib["name"] for meta_row in resp.findall(".//metadata")
|
|
@@ -159,10 +159,10 @@ class Workspace:
|
|
|
159
159
|
) -> list[Path]:
|
|
160
160
|
"""
|
|
161
161
|
Returns a list of directories that contain a parseable
|
|
162
|
-
.
|
|
162
|
+
.pma file.
|
|
163
163
|
|
|
164
164
|
If strict is False then return directories that simply
|
|
165
|
-
contain a .
|
|
165
|
+
contain a .pma file.
|
|
166
166
|
"""
|
|
167
167
|
ret = []
|
|
168
168
|
pattern = "**/.pma"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vortex_cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.15.1
|
|
4
4
|
Home-page: https://github.com/jordanamos/vortex-cli
|
|
5
5
|
Author: Jordan Amos
|
|
6
6
|
Author-email: jordan.amos@gmail.com
|
|
@@ -76,6 +76,7 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
76
76
|
puakma_db_conn_id = 13
|
|
77
77
|
username = myuser ; Optional - Prompted at runtime if not provided
|
|
78
78
|
password = mypassword ; Optional - Prompted at runtime if not provided
|
|
79
|
+
; Optional
|
|
79
80
|
lib_path = ; additional jars that should be included in the classpath
|
|
80
81
|
java_home = /usr/lib/jvm/java-17-openjdk-amd64/ ; The local path to the JRE to use. Should be the same version running on your server
|
|
81
82
|
java_environment_name = JavaSE-17 ; Java Execution Environment name https://docs.osgi.org/reference/eenames.html
|
|
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
|