]> granicus.if.org Git - pgbouncer/commitdiff
stress.py: Convert to psycopg2
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 19 Jun 2019 14:36:18 +0000 (16:36 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 19 Jun 2019 14:36:18 +0000 (16:36 +0200)
It was still on the ancient psycopg module.

test/stress.py

index e3fdf2ad17e2581958095065e680801d1fa46739..71a9036fac06fe0497e3a76d04189fb16713f407 100755 (executable)
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 
-import sys, os, re, time, psycopg
+import sys, os, re, time, psycopg2
 import threading, thread, random
 
 n_thread = 100
@@ -61,9 +61,9 @@ class WorkThread(threading.Thread):
                 except: pass
 
     def main_loop(self):
-        db = psycopg.connect(get_connstr())
+        db = psycopg2.connect(get_connstr())
         if not longtx:
-            db.autocommit(1)
+            db.autocommit = True
         n = 0
         while n < 10:
             self.do_work(db)