import os import paramiko pw = os.environ["DEPLOY_PASSWORD"] c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("20.191.152.26", username="wakka", password=pw, timeout=30) cmd = r"""sudo docker exec guest-chat-postgres-1 psql -U postgres -d chatwoot_production -c " SELECT id, pre_chat_form_enabled, feature_flags FROM channel_web_widgets; SELECT m.id, m.conversation_id, m.message_type, left(m.content,60), m.created_at FROM messages ORDER BY id DESC LIMIT 5; " """ _, o, _ = c.exec_command(cmd, timeout=30) print(o.read().decode(errors='replace')) c.close()