# Creating a cursor doesn't start a transaction or affect the connection
# in any way.
- cur = con.cursor()
+ cur = conn.cursor()
cur.execute("SELECT count(*) FROM my_table")
# This function call executes:
with psycopg.connect() as conn:
- cur = con.cursor()
+ cur = conn.cursor()
cur.execute("SELECT count(*) FROM my_table")
# This function call executes:
with psycopg.connect(autocommit=True) as conn:
- cur = con.cursor()
+ cur = conn.cursor()
cur.execute("SELECT count(*) FROM my_table")
# This function call now only executes:
with psycopg.connect(autocommit=True) as conn:
- cur = con.cursor()
+ cur = conn.cursor()
cur.execute("SELECT count(*) FROM my_table")
# The connection is autocommit, so no BEGIN executed.
conn = psycopg.connect()
- cur = con.cursor()
+ cur = conn.cursor()
cur.execute("SELECT count(*) FROM my_table")
# This function call executes: