How can I cancel a query using pyscopg2 (python Postgres driver)?
As an example, suppose I have the following code:
import psycopg2 cnx_string = "something_appropriate" conn = psycopg2.connect(cnx_string) cur = conn.cursor() cur.execute("long_running_query")
Then I want to cancel execution of this long request from another thread - what method do I need to call for connection / cursor objects for this?
source share