prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  GenericTransfer and Postgres - ERROR - SET AUTOCOMMIT TO OFF is no longer supported
  Trying to implement a generic transfer
  
  ``` python
  t1 = GenericTransfer(
    task_id = 'copy_small_table',
    sql = "select * from my_schema.my_table",
    destination_table = "my_schema.my_table",
    source_conn_id = "postgres9.1.13",
    destination_conn_id = "postgres9.4.5",
    dag=dag
  )
  ```
  
  I get the following error:
  
  ```
  --------------------------------------------------------------------------------
  New run starting @2015-11-25T11:05:40.673401
  --------------------------------------------------------------------------------
  [2015-11-25 11:05:40,698] {models.py:951} INFO - Executing <Task(GenericTransfer): copy_my_table_v1> on 2015-11-24 00:00:00
  [2015-11-25 11:05:40,711] {base_hook.py:53} INFO - Using connection to: 10.x.x.x
  [2015-11-25 11:05:40,711] {generic_transfer.py:53} INFO - Extracting data from my_db
  [2015-11-25 11:05:40,711] {generic_transfer.py:54} INFO - Executing: 
  select * from my_schema.my_table
  [2015-11-25 11:05:40,713] {base_hook.py:53} INFO - Using connection to: 10.x.x.x
  [2015-11-25 11:05:40,808] {base_hook.py:53} INFO - Using connection to: 10.x.x.x
  [2015-11-25 11:05:45,271] {base_hook.py:53} INFO - Using connection to: 10.x.x.x
  [2015-11-25 11:05:45,272] {generic_transfer.py:63} INFO - Inserting rows into 10.x.x.x
  [2015-11-25 11:05:45,273] {base_hook.py:53} INFO - Using connection to: 10.x.x.x
  [2015-11-25 11:05:45,305] {models.py:1017} ERROR - SET AUTOCOMMIT TO OFF is no longer supported
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 977, in run
      result = task_copy.execute(context=context)
    File "/usr/local/lib/python2.7/dist-packages/airflow/operators/generic_transfer.py", line 64, in execute
      destination_hook.insert_rows(table=self.destination_table, rows=results)
    File "/usr/local/lib/python2.7/dist-packages/airflow/hooks/dbapi_hook.py", line 136, in insert_rows
      cur.execute('SET autocommit = 0')
  NotSupportedError: SET AUTOCOMMIT TO OFF is no longer supported
  
  [2015-11-25 11:05:45,330] {models.py:1053} ERROR - SET AUTOCOMMIT TO OFF is no longer supported
  ```
  
  Python 2.7
  Airflow 1.6.1
  psycopg2 2.6 (Also tried 2.6.1)
  Postgeres destination 9.4.5
  
  Any idea on what might cause this problem?
  
  
  </issue>
  <code>
  [start of airflow/hooks/postgres_hook.py]
  1 import psycopg2
  2 
  3 from airflow.hooks.dbapi_hook import DbApiHook
  4 
  5 
  6 class PostgresHook(DbApiHook):
  7     '''
  8     Interact with Postgres.
  9     You can specify ssl parameters in the extra field of your connection
  10     as ``{"sslmode": "require", "sslcert": "/path/to/cert.pem", etc}``.
  11     '''
  12     conn_name_attr = 'postgres_conn_id'
  13     default_conn_name = 'postgres_default'
  14     supports_autocommit = True
  15 
  16     def get_conn(self):
  17         conn = self.get_connection(self.postgres_conn_id)
  18         conn_args = dict(
  19             host=conn.host,
  20             user=conn.login,
  21             password=conn.password,
  22             dbname=conn.schema,
  23             port=conn.port)
  24         # check for ssl parameters in conn.extra
  25         for arg_name, arg_val in conn.extra_dejson.items():
  26             if arg_name in ['sslmode', 'sslcert', 'sslkey', 'sslrootcert', 'sslcrl']:
  27                 conn_args[arg_name] = arg_val
  28         return psycopg2.connect(**conn_args)
  29
  [end of airflow/hooks/postgres_hook.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/airflow/hooks/postgres_hook.py b/airflow/hooks/postgres_hook.py
  --- a/airflow/hooks/postgres_hook.py
  +++ b/airflow/hooks/postgres_hook.py
  @@ -11,7 +11,7 @@
       '''
       conn_name_attr = 'postgres_conn_id'
       default_conn_name = 'postgres_default'
  -    supports_autocommit = True
  +    supports_autocommit = False
   
       def get_conn(self):
           conn = self.get_connection(self.postgres_conn_id)
  @@ -25,4 +25,7 @@
           for arg_name, arg_val in conn.extra_dejson.items():
               if arg_name in ['sslmode', 'sslcert', 'sslkey', 'sslrootcert', 'sslcrl']:
                   conn_args[arg_name] = arg_val
  -        return psycopg2.connect(**conn_args)
  +        psycopg2_conn = psycopg2.connect(**conn_args)
  +        if psycopg2_conn.server_version < 70400:
  +            self.supports_autocommit = True
  +        return psycopg2_conn
  
verification_info: {"golden_diff": "diff --git a/airflow/hooks/postgres_hook.py b/airflow/hooks/postgres_hook.py\n--- a/airflow/hooks/postgres_hook.py\n+++ b/airflow/hooks/postgres_hook.py\n@@ -11,7 +11,7 @@\n     '''\n     conn_name_attr = 'postgres_conn_id'\n     default_conn_name = 'postgres_default'\n-    supports_autocommit = True\n+    supports_autocommit = False\n \n     def get_conn(self):\n         conn = self.get_connection(self.postgres_conn_id)\n@@ -25,4 +25,7 @@\n         for arg_name, arg_val in conn.extra_dejson.items():\n             if arg_name in ['sslmode', 'sslcert', 'sslkey', 'sslrootcert', 'sslcrl']:\n                 conn_args[arg_name] = arg_val\n-        return psycopg2.connect(**conn_args)\n+        psycopg2_conn = psycopg2.connect(**conn_args)\n+        if psycopg2_conn.server_version < 70400:\n+            self.supports_autocommit = True\n+        return psycopg2_conn\n", "issue": "GenericTransfer and Postgres - ERROR - SET AUTOCOMMIT TO OFF is no longer supported\nTrying to implement a generic transfer\n\n``` python\nt1 = GenericTransfer(\n  task_id = 'copy_small_table',\n  sql = \"select * from my_schema.my_table\",\n  destination_table = \"my_schema.my_table\",\n  source_conn_id = \"postgres9.1.13\",\n  destination_conn_id = \"postgres9.4.5\",\n  dag=dag\n)\n```\n\nI get the following error:\n\n```\n--------------------------------------------------------------------------------\nNew run starting @2015-11-25T11:05:40.673401\n--------------------------------------------------------------------------------\n[2015-11-25 11:05:40,698] {models.py:951} INFO - Executing <Task(GenericTransfer): copy_my_table_v1> on 2015-11-24 00:00:00\n[2015-11-25 11:05:40,711] {base_hook.py:53} INFO - Using connection to: 10.x.x.x\n[2015-11-25 11:05:40,711] {generic_transfer.py:53} INFO - Extracting data from my_db\n[2015-11-25 11:05:40,711] {generic_transfer.py:54} INFO - Executing: \nselect * from my_schema.my_table\n[2015-11-25 11:05:40,713] {base_hook.py:53} INFO - Using connection to: 10.x.x.x\n[2015-11-25 11:05:40,808] {base_hook.py:53} INFO - Using connection to: 10.x.x.x\n[2015-11-25 11:05:45,271] {base_hook.py:53} INFO - Using connection to: 10.x.x.x\n[2015-11-25 11:05:45,272] {generic_transfer.py:63} INFO - Inserting rows into 10.x.x.x\n[2015-11-25 11:05:45,273] {base_hook.py:53} INFO - Using connection to: 10.x.x.x\n[2015-11-25 11:05:45,305] {models.py:1017} ERROR - SET AUTOCOMMIT TO OFF is no longer supported\nTraceback (most recent call last):\n  File \"/usr/local/lib/python2.7/dist-packages/airflow/models.py\", line 977, in run\n    result = task_copy.execute(context=context)\n  File \"/usr/local/lib/python2.7/dist-packages/airflow/operators/generic_transfer.py\", line 64, in execute\n    destination_hook.insert_rows(table=self.destination_table, rows=results)\n  File \"/usr/local/lib/python2.7/dist-packages/airflow/hooks/dbapi_hook.py\", line 136, in insert_rows\n    cur.execute('SET autocommit = 0')\nNotSupportedError: SET AUTOCOMMIT TO OFF is no longer supported\n\n[2015-11-25 11:05:45,330] {models.py:1053} ERROR - SET AUTOCOMMIT TO OFF is no longer supported\n```\n\nPython 2.7\nAirflow 1.6.1\npsycopg2 2.6 (Also tried 2.6.1)\nPostgeres destination 9.4.5\n\nAny idea on what might cause this problem?\n\n", "before_files": [{"content": "import psycopg2\n\nfrom airflow.hooks.dbapi_hook import DbApiHook\n\n\nclass PostgresHook(DbApiHook):\n    '''\n    Interact with Postgres.\n    You can specify ssl parameters in the extra field of your connection\n    as ``{\"sslmode\": \"require\", \"sslcert\": \"/path/to/cert.pem\", etc}``.\n    '''\n    conn_name_attr = 'postgres_conn_id'\n    default_conn_name = 'postgres_default'\n    supports_autocommit = True\n\n    def get_conn(self):\n        conn = self.get_connection(self.postgres_conn_id)\n        conn_args = dict(\n            host=conn.host,\n            user=conn.login,\n            password=conn.password,\n            dbname=conn.schema,\n            port=conn.port)\n        # check for ssl parameters in conn.extra\n        for arg_name, arg_val in conn.extra_dejson.items():\n            if arg_name in ['sslmode', 'sslcert', 'sslkey', 'sslrootcert', 'sslcrl']:\n                conn_args[arg_name] = arg_val\n        return psycopg2.connect(**conn_args)\n", "path": "airflow/hooks/postgres_hook.py"}]}