diff --git a/testing-trigger.py b/testing-trigger.py index 069ff9eb71c6488166aae764e3a9a53d5f298953..068cfc2dbc45e605775f46a5d4c57b1b9f2d5622 100644 --- a/testing-trigger.py +++ b/testing-trigger.py @@ -5,38 +5,38 @@ import subprocess def executePrint(s): cur.execute(s) - print cur.fetchall() + print(cur.fetchall()) subprocess.call(["psql", "-f", "/vagrant/trigger.sql", "flightsskewed"]) -conn = psycopg2.connect("dbname=flightsskewed user=vagrant") +conn = psycopg2.connect("dbname=flightsskewed user=ubuntu") cur = conn.cursor() ## Add a customer who doesn't exist -print "==== Testing: adding a customer without a flewon entry" +print("==== Testing: adding a customer without a flewon entry") executePrint("select * from NumberOfFlightsTaken where customerid = 'cust731'") -print "Inserting a flewon entry for cust731" +print("Inserting a flewon entry for cust731") cur.execute("insert into flewon values ('AA101', 'cust731', to_date('2016-08-09', 'YYYY-MM-DD'))"); conn.commit() -print "Rerunning the query" +print("Rerunning the query") executePrint("select * from NumberOfFlightsTaken where customerid = 'cust731'") ## Remove a customer with a few entries -print "==== Testing: removing a customer's all flewon entries" +print("==== Testing: removing a customer's all flewon entries") executePrint("select * from NumberOfFlightsTaken where customerid = 'cust597'") cur.execute("delete from flewon where customerid = 'cust597' and flightid = 'F9103'") conn.commit() -print "Rerunning the query after deleting one entry" +print("Rerunning the query after deleting one entry") executePrint("select * from NumberOfFlightsTaken where customerid = 'cust597'") cur.execute("delete from flewon where customerid = 'cust597' and flightid = 'AA134'") conn.commit() -print "Rerunning the query after deleting both entries" +print("Rerunning the query after deleting both entries") executePrint("select * from NumberOfFlightsTaken where customerid = 'cust597'") ## Cleanup