'psycopg2 connect to postgres using custom websocket
I have a postgres cluster deployed in kubernetes and I am doing port-forwarding so that I can access the pod from outside the kubernetes cluster
from kubernetes.stream import portforward
pf = portforward(
self.core_v_api.connect_get_namespaced_pod_portforward,
name, namespace,
ports=str(ports),
)
return pf
This returns me a websocket:
<websocket._core.WebSocket object at 0x7ff628132c50>
I have to use this WebSocket to connect with the Postgres, is there a way I can use psycopg2 with a custom WebSocket or any other way?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
