kaqing 2.0.48__tar.gz → 2.0.49__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.
- {kaqing-2.0.48 → kaqing-2.0.49}/PKG-INFO +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/batch.py +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/alter_tables.py +1 -1
- kaqing-2.0.49/adam/commands/cql/cql_completions.py +12 -0
- kaqing-2.0.49/adam/commands/cql/cql_table_completer.py +16 -0
- {kaqing-2.0.48/adam/commands → kaqing-2.0.49/adam/commands/cql}/cqlsh.py +6 -15
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/describe/describe_keyspace.py +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/describe/describe_keyspaces.py +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/describe/describe_table.py +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/describe/describe_tables.py +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/ls.py +1 -1
- kaqing-2.0.49/adam/commands/postgres/pg_completions.py +9 -0
- kaqing-2.0.49/adam/commands/postgres/pg_table_completer.py +18 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/postgres/postgres.py +3 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/preview_table.py +3 -4
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/repl_commands.py +1 -1
- kaqing-2.0.49/adam/sso/__init__.py +0 -0
- kaqing-2.0.48/adam/commands/postgres/pg_table_completer.py → kaqing-2.0.49/adam/table_completer.py +25 -15
- kaqing-2.0.49/adam/version.py +5 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.48 → kaqing-2.0.49}/kaqing.egg-info/SOURCES.txt +6 -2
- {kaqing-2.0.48 → kaqing-2.0.49}/setup.py +1 -1
- kaqing-2.0.48/adam/commands/postgres/pg_completions.py +0 -17
- kaqing-2.0.48/adam/version.py +0 -5
- {kaqing-2.0.48 → kaqing-2.0.49}/README +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/app_session.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/apps.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/check.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/disk.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/issue.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/memory.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/checks/status.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/cli.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/cli_group.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/column.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/columns.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/memory.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/app.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/app_ping.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/bash.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/cd.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/check.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/command.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/cp.py +0 -0
- {kaqing-2.0.48/adam/commands/deploy → kaqing-2.0.49/adam/commands/cql}/__init__.py +0 -0
- {kaqing-2.0.48/adam/commands → kaqing-2.0.49/adam/commands/cql}/cql_utils.py +0 -0
- {kaqing-2.0.48/adam/commands/describe → kaqing-2.0.49/adam/commands/deploy}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/deploy.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/deploy_pg_agent.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/undeploy.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/undeploy_pg_agent.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.48/adam/commands/medusa → kaqing-2.0.49/adam/commands/describe}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/describe/describe.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/devices.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/exit.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/help.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/issues.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/login.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/logs.py +0 -0
- {kaqing-2.0.48/adam/commands/postgres → kaqing-2.0.49/adam/commands/medusa}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.48/adam/commands/reaper → kaqing-2.0.49/adam/commands/postgres}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/postgres/postgres_session.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/postgres/postgres_utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.48/adam/commands/repair → kaqing-2.0.49/adam/commands/reaper}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.48/adam/commands/show → kaqing-2.0.49/adam/commands/repair}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/repair/repair.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/report.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/restart.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/shell.py +0 -0
- {kaqing-2.0.48/adam/k8s_utils → kaqing-2.0.49/adam/commands/show}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_login.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/commands/watch.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/config.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/embedded_params.py +0 -0
- {kaqing-2.0.48/adam/sso → kaqing-2.0.49/adam/k8s_utils}/__init__.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/cassandra_clusters.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/cassandra_nodes.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/config_maps.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/custom_resources.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/deployment.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/ingresses.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/jobs.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/kube_context.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/pods.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/secrets.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/service_accounts.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/services.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/statefulsets.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/k8s_utils/volumes.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/log.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/pod_exec_result.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/repl.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/repl_session.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/repl_state.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/idp.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/adam/utils.py +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.48 → kaqing-2.0.49}/setup.cfg +0 -0
@@ -5,7 +5,7 @@ from adam.commands.check import Check, CheckCommandHelper
|
|
5
5
|
from adam.commands.cp import ClipboardCopy, CopyCommandHelper
|
6
6
|
from adam.commands.command import Command
|
7
7
|
from adam.commands.command_helpers import ClusterCommandHelper, ClusterOrPodCommandHelper, PodCommandHelper
|
8
|
-
from adam.commands.cqlsh import CqlCommandHelper, Cqlsh
|
8
|
+
from adam.commands.cql.cqlsh import CqlCommandHelper, Cqlsh
|
9
9
|
from adam.commands.deploy.deploy import Deploy, DeployCommandHelper
|
10
10
|
from adam.commands.deploy.undeploy import Undeploy, UndeployCommandHelper
|
11
11
|
from adam.commands.describe.describe import Describe, DescribeCommandHelper
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
-
from adam.commands.cql_utils import tables as get_tables, run_cql
|
2
|
+
from adam.commands.cql.cql_utils import tables as get_tables, run_cql
|
3
3
|
from adam.config import Config
|
4
4
|
from adam.pod_exec_result import PodExecResult
|
5
5
|
from adam.repl_state import ReplState, RequiredState
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from adam.commands.cql.cql_table_completer import CqlTableCompleter
|
2
|
+
from adam.commands.cql.cql_utils import table_names
|
3
|
+
from adam.repl_state import ReplState
|
4
|
+
|
5
|
+
def cql_completions(state: ReplState) -> dict[str, any]:
|
6
|
+
completer = CqlTableCompleter(table_names(state))
|
7
|
+
return {
|
8
|
+
'describe': {
|
9
|
+
'keyspaces': None,
|
10
|
+
'table': completer.completions(),
|
11
|
+
'tables': None},
|
12
|
+
} | completer.completions()
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from adam.table_completer import NestedDict, TableCompleter
|
2
|
+
|
3
|
+
class CqlTableCompleter(TableCompleter):
|
4
|
+
def __init__(self, tables: list[str], nested_dict: NestedDict = {}, ignore_case: bool = True):
|
5
|
+
self._tables = tables
|
6
|
+
self.ignore_case = ignore_case
|
7
|
+
self.append_nested_dict(nested_dict)
|
8
|
+
|
9
|
+
def __repr__(self) -> str:
|
10
|
+
return "CqlTableCompleter(%r)" % (len(self._tables))
|
11
|
+
|
12
|
+
def nested(self, data: NestedDict) -> 'TableCompleter':
|
13
|
+
return CqlTableCompleter(self._tables).append_nested_dict(data)
|
14
|
+
|
15
|
+
def tables(self) -> list[str]:
|
16
|
+
return self._tables
|
@@ -2,7 +2,8 @@ import click
|
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
4
|
from adam.commands.command_helpers import ClusterOrPodCommandHelper
|
5
|
-
from adam.commands.
|
5
|
+
from adam.commands.cql.cql_completions import cql_completions
|
6
|
+
from .cql_utils import run_cql, table_names
|
6
7
|
from adam.repl_state import ReplState, RequiredState
|
7
8
|
from adam.utils import log, log2
|
8
9
|
|
@@ -53,21 +54,11 @@ class Cqlsh(Command):
|
|
53
54
|
return run_cql(state, cql, opts, show_out=True)
|
54
55
|
|
55
56
|
def completion(self, state: ReplState) -> dict[str, any]:
|
57
|
+
if state.device != state.C:
|
58
|
+
return {}
|
59
|
+
|
56
60
|
if state.sts or state.pod:
|
57
|
-
|
58
|
-
return {Cqlsh.COMMAND: None} | {
|
59
|
-
'delete': {'from': {t: {'where': {'id': {'=': None}}} for t in ts}},
|
60
|
-
'insert': {'into': {t: {'values': None} for t in ts}},
|
61
|
-
'select': {'*': {'from': {t: {
|
62
|
-
'limit': {'1': None},
|
63
|
-
'where': {'id': {'=': None}}
|
64
|
-
} for t in ts}}},
|
65
|
-
'update': {t: {'set': None} for t in ts},
|
66
|
-
'describe': {
|
67
|
-
'keyspaces': None,
|
68
|
-
'table': {t: None for t in ts},
|
69
|
-
'tables': None},
|
70
|
-
}
|
61
|
+
return {Cqlsh.COMMAND: None} | cql_completions(state)
|
71
62
|
|
72
63
|
return {}
|
73
64
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
-
from adam.commands.cql_utils import keyspaces, run_cql
|
2
|
+
from adam.commands.cql.cql_utils import keyspaces, run_cql
|
3
3
|
from adam.pod_exec_result import PodExecResult
|
4
4
|
from adam.repl_state import ReplState, RequiredState
|
5
5
|
from adam.utils import log2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
-
from adam.commands.cql_utils import run_cql
|
2
|
+
from adam.commands.cql.cql_utils import run_cql
|
3
3
|
from adam.pod_exec_result import PodExecResult
|
4
4
|
from adam.repl_state import ReplState, RequiredState
|
5
5
|
from adam.utils import log2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
-
from adam.commands.cql_utils import run_cql, table_names
|
2
|
+
from adam.commands.cql.cql_utils import run_cql, table_names
|
3
3
|
from adam.pod_exec_result import PodExecResult
|
4
4
|
from adam.repl_state import ReplState, RequiredState
|
5
5
|
from adam.utils import log2
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
-
from adam.commands.cql_utils import run_cql
|
2
|
+
from adam.commands.cql.cql_utils import run_cql
|
3
3
|
from adam.pod_exec_result import PodExecResult
|
4
4
|
from adam.repl_state import ReplState, RequiredState
|
5
5
|
from adam.utils import log2
|
@@ -2,7 +2,7 @@ import copy
|
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
4
|
from adam.commands.commands_utils import show_pods, show_rollout
|
5
|
-
from adam.commands.cqlsh import Cqlsh
|
5
|
+
from adam.commands.cql.cqlsh import Cqlsh
|
6
6
|
from adam.commands.postgres.postgres_utils import pg_database_names, pg_table_names
|
7
7
|
from adam.commands.postgres.postgres_session import PostgresSession
|
8
8
|
from adam.config import Config
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from adam.commands.postgres.postgres_utils import pg_table_names
|
2
|
+
from adam.table_completer import NestedDict, TableCompleter
|
3
|
+
|
4
|
+
class PgTableCompleter(TableCompleter):
|
5
|
+
def __init__(self, namespace: str, pg_path: str, nested_dict: NestedDict = {}, ignore_case: bool = True):
|
6
|
+
self.namespace = namespace
|
7
|
+
self.pg_path = pg_path
|
8
|
+
self.ignore_case = ignore_case
|
9
|
+
self.append_nested_dict(nested_dict)
|
10
|
+
|
11
|
+
def __repr__(self) -> str:
|
12
|
+
return "PgTableCompleter(%r, pg_path=%r)" % (self.namespace, self.pg_path)
|
13
|
+
|
14
|
+
def nested(self, data: NestedDict) -> 'TableCompleter':
|
15
|
+
return PgTableCompleter(self.namespace, self.pg_path).append_nested_dict(data)
|
16
|
+
|
17
|
+
def tables(self) -> list[str]:
|
18
|
+
return pg_table_names(self.namespace, self.pg_path)
|
@@ -65,6 +65,9 @@ class Postgres(Command):
|
|
65
65
|
PostgresSession(state.namespace, state.pg_path).run_sql(' '.join(args))
|
66
66
|
|
67
67
|
def completion(self, state: ReplState):
|
68
|
+
if state.device != state.P:
|
69
|
+
return {}
|
70
|
+
|
68
71
|
leaf = {}
|
69
72
|
session = PostgresSession(state.namespace, state.pg_path)
|
70
73
|
if session.db:
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import functools
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
|
-
from adam.commands.
|
4
|
+
from adam.commands.cql.cql_table_completer import CqlTableCompleter
|
5
|
+
from adam.commands.cql.cql_utils import run_cql, table_names, tables
|
5
6
|
from adam.commands.postgres.pg_table_completer import PgTableCompleter
|
6
7
|
from adam.commands.postgres.postgres_session import PostgresSession
|
7
8
|
from adam.config import Config
|
@@ -72,11 +73,9 @@ class PreviewTable(Command):
|
|
72
73
|
|
73
74
|
def completion(self, state: ReplState):
|
74
75
|
if state.device == ReplState.P:
|
75
|
-
# return {PreviewTable.COMMAND: {f'<pg_tables:{state.namespace}:{state.pg_path}>': None}}
|
76
76
|
return {PreviewTable.COMMAND: PgTableCompleter(state.namespace, state.pg_path)}
|
77
77
|
elif state.sts:
|
78
|
-
|
79
|
-
return {PreviewTable.COMMAND: {f'{k}.{t}': None for k, ts in tables.items() for t in ts}}
|
78
|
+
return {PreviewTable.COMMAND: CqlTableCompleter(table_names(state))}
|
80
79
|
|
81
80
|
return {}
|
82
81
|
|
@@ -23,7 +23,7 @@ from adam.commands.bash import Bash
|
|
23
23
|
from adam.commands.cd import Cd
|
24
24
|
from adam.commands.check import Check
|
25
25
|
from adam.commands.command import Command
|
26
|
-
from adam.commands.cqlsh import Cqlsh
|
26
|
+
from adam.commands.cql.cqlsh import Cqlsh
|
27
27
|
from adam.commands.devices import DeviceApp, DeviceCass, DevicePostgres
|
28
28
|
from adam.commands.exit import Exit
|
29
29
|
from adam.commands.medusa.medusa import Medusa
|
File without changes
|
kaqing-2.0.48/adam/commands/postgres/pg_table_completer.py → kaqing-2.0.49/adam/table_completer.py
RENAMED
@@ -1,25 +1,16 @@
|
|
1
|
+
from abc import abstractmethod
|
1
2
|
from typing import Any, Dict, Iterable, Mapping, Optional, Set, Union
|
2
3
|
from prompt_toolkit.completion import CompleteEvent, Completer, Completion, NestedCompleter, WordCompleter
|
3
4
|
from prompt_toolkit.document import Document
|
4
5
|
|
5
|
-
from adam.commands.postgres.postgres_utils import pg_table_names
|
6
|
-
|
7
6
|
NestedDict = Mapping[str, Union[Any, Set[str], None, Completer]]
|
8
7
|
|
9
|
-
class
|
10
|
-
def __init__(self,
|
11
|
-
self.namespace = namespace
|
12
|
-
self.pg_path = pg_path
|
8
|
+
class TableCompleter(Completer):
|
9
|
+
def __init__(self, nested_dict: NestedDict = {}, ignore_case: bool = True):
|
13
10
|
self.ignore_case = ignore_case
|
14
11
|
self.append_nested_dict(nested_dict)
|
15
12
|
|
16
|
-
def
|
17
|
-
return "PgTableCompleter(%r, pg_path=%r)" % (self.namespace, self.pg_path)
|
18
|
-
|
19
|
-
def nested(self, data: NestedDict):
|
20
|
-
return PgTableCompleter(self.namespace, self.pg_path).append_nested_dict(data)
|
21
|
-
|
22
|
-
def append_nested_dict(self, data: NestedDict) -> "PgTableCompleter":
|
13
|
+
def append_nested_dict(self, data: NestedDict) -> "TableCompleter":
|
23
14
|
options: Dict[str, Optional[Completer]] = {}
|
24
15
|
for key, value in data.items():
|
25
16
|
if isinstance(value, Completer):
|
@@ -77,7 +68,26 @@ class PgTableCompleter(Completer):
|
|
77
68
|
yield c
|
78
69
|
else:
|
79
70
|
completer = WordCompleter(
|
80
|
-
|
71
|
+
self.tables(), ignore_case=self.ignore_case
|
81
72
|
)
|
82
73
|
for c in completer.get_completions(document, complete_event):
|
83
|
-
yield c
|
74
|
+
yield c
|
75
|
+
|
76
|
+
@abstractmethod
|
77
|
+
def nested(self, data: NestedDict) -> 'TableCompleter':
|
78
|
+
pass
|
79
|
+
|
80
|
+
@abstractmethod
|
81
|
+
def tables(self) -> list[str]:
|
82
|
+
pass
|
83
|
+
|
84
|
+
def completions(self):
|
85
|
+
return {
|
86
|
+
'delete': {'from': self.nested({'where': {'id': {'=': {"'id'": None}}}})},
|
87
|
+
'insert': {'into': self.nested({'values(': None})},
|
88
|
+
'select': {'*': {'from': self.nested({
|
89
|
+
'limit': {'1': {'where': {'id': {'=': {"'id'": None}}}}},
|
90
|
+
'where': {'id': {'=': {"'id'": {'limit': {'1': None}}}}}
|
91
|
+
})}},
|
92
|
+
'update': self.nested({'set': {'column': {'=': None}}}),
|
93
|
+
}
|
@@ -15,6 +15,7 @@ adam/repl.py
|
|
15
15
|
adam/repl_commands.py
|
16
16
|
adam/repl_session.py
|
17
17
|
adam/repl_state.py
|
18
|
+
adam/table_completer.py
|
18
19
|
adam/utils.py
|
19
20
|
adam/version.py
|
20
21
|
adam/checks/__init__.py
|
@@ -60,8 +61,6 @@ adam/commands/command.py
|
|
60
61
|
adam/commands/command_helpers.py
|
61
62
|
adam/commands/commands_utils.py
|
62
63
|
adam/commands/cp.py
|
63
|
-
adam/commands/cql_utils.py
|
64
|
-
adam/commands/cqlsh.py
|
65
64
|
adam/commands/devices.py
|
66
65
|
adam/commands/exit.py
|
67
66
|
adam/commands/help.py
|
@@ -80,6 +79,11 @@ adam/commands/restart.py
|
|
80
79
|
adam/commands/rollout.py
|
81
80
|
adam/commands/shell.py
|
82
81
|
adam/commands/watch.py
|
82
|
+
adam/commands/cql/__init__.py
|
83
|
+
adam/commands/cql/cql_completions.py
|
84
|
+
adam/commands/cql/cql_table_completer.py
|
85
|
+
adam/commands/cql/cql_utils.py
|
86
|
+
adam/commands/cql/cqlsh.py
|
83
87
|
adam/commands/deploy/__init__.py
|
84
88
|
adam/commands/deploy/code_start.py
|
85
89
|
adam/commands/deploy/code_stop.py
|
@@ -1,17 +0,0 @@
|
|
1
|
-
from adam.commands.postgres.pg_table_completer import PgTableCompleter
|
2
|
-
|
3
|
-
def pg_completions(ns: str, pg_path: str):
|
4
|
-
table = PgTableCompleter(ns, pg_path)
|
5
|
-
return {
|
6
|
-
'\h': None,
|
7
|
-
'\d': None,
|
8
|
-
'\dt': None,
|
9
|
-
'\du': None,
|
10
|
-
'delete': {'from': table.nested({'where': {'id': {'=': {"'id'": None}}}})},
|
11
|
-
'insert': {'into': table.nested({'values(': None})},
|
12
|
-
'select': {'*': {'from': table.nested({
|
13
|
-
'limit': {'1': {'where': {'id': {'=': {"'id'": None}}}}},
|
14
|
-
'where': {'id': {'=': {"'id'": {'limit': {'1': None}}}}}
|
15
|
-
})}},
|
16
|
-
'update': table.nested({'set': {'column': {'=': None}}}),
|
17
|
-
}
|
kaqing-2.0.48/adam/version.py
DELETED
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
|
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
|
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
|
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
|
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
|