kaqing 2.0.40__tar.gz → 2.0.42__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.40 → kaqing-2.0.42}/PKG-INFO +1 -1
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/cd.py +2 -1
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/ls.py +3 -6
- kaqing-2.0.42/adam/commands/postgres/pg_utils.py +18 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/postgres/postgres.py +6 -14
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/preview_table.py +4 -18
- kaqing-2.0.42/adam/version.py +5 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.40 → kaqing-2.0.42}/kaqing.egg-info/SOURCES.txt +1 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/setup.py +1 -1
- kaqing-2.0.40/adam/version.py +0 -5
- {kaqing-2.0.40 → kaqing-2.0.42}/README +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/app_session.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/apps.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/batch.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/check.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/disk.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/issue.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/memory.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/checks/status.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/cli.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/cli_group.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/column.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/columns.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/memory.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/alter_tables.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/app.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/app_ping.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/bash.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/check.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/command.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/cp.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/cql_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/cqlsh.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/deploy.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/deploy_pg_agent.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/undeploy.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/undeploy_pg_agent.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/describe.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/describe_keyspace.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/describe_keyspaces.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/describe_table.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/describe/describe_tables.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/devices.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/exit.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/help.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/issues.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/login.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/logs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/medusa_show_backupjobs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/postgres/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/postgres/postgres_session.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/repair.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/report.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/restart.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/shell.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_app_actions.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_app_queues.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_login.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/commands/watch.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/config.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/embedded_params.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/cassandra_clusters.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/cassandra_nodes.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/config_maps.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/custom_resources.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/deployment.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/ingresses.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/jobs.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/kube_context.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/pods.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/secrets.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/service_accounts.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/services.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/statefulsets.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/k8s_utils/volumes.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/log.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/pod_exec_result.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/repl.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/repl_commands.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/repl_session.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/repl_state.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/__init__.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/idp.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/adam/utils.py +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.40 → kaqing-2.0.42}/setup.cfg +0 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
from adam.commands.command import Command
|
2
|
+
from adam.commands.postgres.pg_utils import pg_database_names
|
2
3
|
from adam.commands.postgres.postgres_session import PostgresSession
|
3
4
|
from adam.k8s_utils.cassandra_clusters import CassandraClusters
|
4
5
|
from adam.k8s_utils.kube_context import KubeContext
|
@@ -91,7 +92,7 @@ class Cd(Command):
|
|
91
92
|
if pg and pg.db:
|
92
93
|
return {Cd.COMMAND: {'..': None}}
|
93
94
|
elif pg and pg.host:
|
94
|
-
return {Cd.COMMAND: {'..': None} | {p
|
95
|
+
return {Cd.COMMAND: {'..': None} | {p: None for p in pg_database_names(state.namespace, pg.directory())}}
|
95
96
|
else:
|
96
97
|
return {Cd.COMMAND: {p: None for p in PostgresSession.hosts(state.namespace)}}
|
97
98
|
elif state.device == ReplState.A:
|
@@ -4,6 +4,7 @@ import re
|
|
4
4
|
from adam.commands.command import Command
|
5
5
|
from adam.commands.commands_utils import show_pods, show_rollout
|
6
6
|
from adam.commands.cqlsh import Cqlsh
|
7
|
+
from adam.commands.postgres.pg_utils import pg_database_names, pg_table_names
|
7
8
|
from adam.commands.postgres.postgres_session import PostgresSession
|
8
9
|
from adam.config import Config
|
9
10
|
from adam.k8s_utils.custom_resources import CustomResources
|
@@ -123,14 +124,10 @@ class Ls(Command):
|
|
123
124
|
log(lines_to_tabular(lines, 'NAME,NAMESPACE,ENDPOINT,USERNAME,PASSWORD', separator=','))
|
124
125
|
|
125
126
|
def show_pg_databases(self, pg: PostgresSession):
|
126
|
-
|
127
|
-
|
128
|
-
log(lines_to_tabular(lines, 'DATABASE', separator=','))
|
127
|
+
log(lines_to_tabular(pg_database_names(pg.namespace, pg.directory()), 'DATABASE', separator=','))
|
129
128
|
|
130
129
|
def show_pg_tables(self, pg: PostgresSession):
|
131
|
-
|
132
|
-
|
133
|
-
log(lines_to_tabular(lines, 'NAME', separator=','))
|
130
|
+
log(lines_to_tabular(pg_table_names(pg.namespace, pg.directory()), 'NAME', separator=','))
|
134
131
|
|
135
132
|
def completion(self, state: ReplState):
|
136
133
|
if state.pod:
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import functools
|
2
|
+
|
3
|
+
from adam.commands.postgres.postgres_session import PostgresSession
|
4
|
+
|
5
|
+
def pg_database_names(ns: str, pg_path: str):
|
6
|
+
pg = PostgresSession(ns, pg_path)
|
7
|
+
return [db['name'] for db in pg.databases() if db['owner'] == PostgresSession.default_owner()]
|
8
|
+
|
9
|
+
@functools.lru_cache()
|
10
|
+
def pg_table_names(ns: str, pg_path: str):
|
11
|
+
return [table['name'] for table in pg_tables(ns, pg_path) if table['schema'] == PostgresSession.default_schema()]
|
12
|
+
|
13
|
+
def pg_tables(ns: str, pg_path: str):
|
14
|
+
pg = PostgresSession(ns, pg_path)
|
15
|
+
if pg.db:
|
16
|
+
return pg.tables()
|
17
|
+
|
18
|
+
return []
|
@@ -2,6 +2,7 @@ import functools
|
|
2
2
|
import click
|
3
3
|
|
4
4
|
from adam.commands.command import Command
|
5
|
+
from adam.commands.postgres.pg_utils import pg_table_names
|
5
6
|
from .postgres_ls import PostgresLs
|
6
7
|
from .postgres_preview import PostgresPreview
|
7
8
|
from .postgres_session import PostgresSession
|
@@ -67,19 +68,19 @@ class Postgres(Command):
|
|
67
68
|
leaf = {}
|
68
69
|
session = PostgresSession(state.namespace, state.pg_path)
|
69
70
|
if session.db:
|
70
|
-
|
71
|
+
if tables := pg_table_names(state.namespace, state.pg_path):
|
71
72
|
leaf = {
|
72
73
|
'\h': None,
|
73
74
|
'\d': None,
|
74
75
|
'\dt': None,
|
75
76
|
'\du': None,
|
76
|
-
'delete': {'from': {t: {'where': {'id': {'=': None}}} for t in
|
77
|
-
'insert': {'into': {t: {'values': None} for t in
|
77
|
+
'delete': {'from': {t: {'where': {'id': {'=': None}}} for t in tables}},
|
78
|
+
'insert': {'into': {t: {'values': None} for t in tables}},
|
78
79
|
'select': {'*': {'from': {t: {
|
79
80
|
'limit': {'1': None},
|
80
81
|
'where': {'id': {'=': None}}
|
81
|
-
} for t in
|
82
|
-
'update': {t: {'set': None} for t in
|
82
|
+
} for t in tables}}},
|
83
|
+
'update': {t: {'set': None} for t in tables},
|
83
84
|
}
|
84
85
|
elif state.pg_path:
|
85
86
|
leaf = {
|
@@ -92,15 +93,6 @@ class Postgres(Command):
|
|
92
93
|
else:
|
93
94
|
return {}
|
94
95
|
|
95
|
-
# TODO fix cache
|
96
|
-
# @functools.lru_cache()
|
97
|
-
def tables(self, ns: str, pg_path: str):
|
98
|
-
session = PostgresSession(ns, pg_path)
|
99
|
-
if session.db:
|
100
|
-
return [f'{t["schema"]}.{t["name"]}' for t in session.tables()]
|
101
|
-
|
102
|
-
return []
|
103
|
-
|
104
96
|
def help(self, _: ReplState):
|
105
97
|
return f'[{Postgres.COMMAND}] <sql-statements>\t run psql with queries'
|
106
98
|
|
@@ -2,9 +2,9 @@ import functools
|
|
2
2
|
|
3
3
|
from adam.commands.command import Command
|
4
4
|
from adam.commands.cql_utils import run_cql, tables
|
5
|
+
from adam.commands.postgres.pg_utils import pg_table_names
|
5
6
|
from adam.commands.postgres.postgres_session import PostgresSession
|
6
7
|
from adam.config import Config
|
7
|
-
from adam.pod_exec_result import PodExecResult
|
8
8
|
from adam.repl_state import ReplState, RequiredState
|
9
9
|
from adam.utils import lines_to_tabular, log, log2
|
10
10
|
|
@@ -72,8 +72,8 @@ class PreviewTable(Command):
|
|
72
72
|
|
73
73
|
def completion(self, state: ReplState):
|
74
74
|
if state.device == ReplState.P:
|
75
|
-
if tables :=
|
76
|
-
return {PreviewTable.COMMAND: {
|
75
|
+
if tables := pg_table_names(state.namespace, state.pg_path):
|
76
|
+
return {PreviewTable.COMMAND: {table: None for table in tables}}
|
77
77
|
elif state.sts:
|
78
78
|
tables = PreviewTable.cql_tables(state)
|
79
79
|
return {PreviewTable.COMMAND: {f'{k}.{t}': None for k, ts in tables.items() for t in ts}}
|
@@ -88,18 +88,4 @@ class PreviewTable(Command):
|
|
88
88
|
if state.pod:
|
89
89
|
return tables(state)
|
90
90
|
|
91
|
-
return tables(state, on_any=True)
|
92
|
-
|
93
|
-
# r: list[PodExecResult] = run_cql(state, 'describe tables', show_out=False, on_any=True)
|
94
|
-
# if not r:
|
95
|
-
# return []
|
96
|
-
|
97
|
-
# return parse_cql_desc_tables(r[0].stdout)
|
98
|
-
|
99
|
-
@functools.lru_cache()
|
100
|
-
def pg_tables(ns: str, pg_path: str):
|
101
|
-
pg = PostgresSession(ns, pg_path)
|
102
|
-
if pg.db:
|
103
|
-
return pg.tables()
|
104
|
-
|
105
|
-
return None
|
91
|
+
return tables(state, on_any=True)
|
@@ -106,6 +106,7 @@ adam/commands/medusa/medusa_restore.py
|
|
106
106
|
adam/commands/medusa/medusa_show_backupjobs.py
|
107
107
|
adam/commands/medusa/medusa_show_restorejobs.py
|
108
108
|
adam/commands/postgres/__init__.py
|
109
|
+
adam/commands/postgres/pg_utils.py
|
109
110
|
adam/commands/postgres/postgres.py
|
110
111
|
adam/commands/postgres/postgres_ls.py
|
111
112
|
adam/commands/postgres/postgres_preview.py
|
kaqing-2.0.40/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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|