Django

Code

Ticket #3460: autocommit.diff

File autocommit.diff, 0.8 kB (added by Jack Moffitt <metajack@gmail.com>, 2 years ago)

switch psycopg2's default isolation level to autocommit

  • django/db/backends/postgresql_psycopg2/base.py

    old new  
    4242            if settings.DATABASE_PORT: 
    4343                conn_string += " port=%s" % settings.DATABASE_PORT 
    4444            self.connection = Database.connect(conn_string, **self.options) 
    45             self.connection.set_isolation_level(1) # make transactions transparent to all cursors 
     45            self.connection.set_isolation_level(0) # autocommit 
    4646        cursor = self.connection.cursor() 
    4747        cursor.tzinfo_factory = None 
    4848        cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])