diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py
index c779d06d3d6817bdf570e51d49839505a5241765..0ce89d49ad47df6e86bda2a95765fb1e371f6dbb 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py
+++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb.py
@@ -67,27 +67,29 @@ class RADatabase:
         return line
 
     def _executeQuery(self, query, qargs=None, fetch=_FETCH_NONE):
-        '''execute the query and reconnect upon OperationalError'''
-        try:
-            if self.log_queries:
-                logger.info('executing query: %s' % self._queryAsSingleLine(query, qargs))
-
-            self.cursor.execute(query, qargs)
-        except (psycopg2.OperationalError, AttributeError) as e:
-            if isinstance(e, psycopg2.OperationalError):
-                logger.error(str(e))
-            for i in range(5):
+        ''' Execute the query and reconnect upon OperationalError '''
+
+        if self.log_queries:
+            logger.info('executing query: %s' % self._queryAsSingleLine(query, qargs))
+
+        # Allow for 5 connection retries
+        for i in range(5):
+            try:
+                self.cursor.execute(query, qargs)
+                break
+            except (psycopg2.OperationalError, AttributeError) as e:
+                if isinstance(e, psycopg2.OperationalError):
+                    logger.error(str(e))
+
                 logger.info("(re)trying to connect to radb")
                 self._connect()
                 if self.conn:
                     logger.info("connected to radb")
-                    self.cursor.execute(query, qargs)
-                    break
                 time.sleep(i*i)
-        except (psycopg2.IntegrityError, psycopg2.ProgrammingError, psycopg2.InternalError, psycopg2.DataError)as e:
-            logger.error("Rolling back query=\'%s\' due to error: \'%s\'" % (self._queryAsSingleLine(query, qargs), e))
-            self.rollback()
-            return []
+            except (psycopg2.IntegrityError, psycopg2.ProgrammingError, psycopg2.InternalError, psycopg2.DataError)as e:
+                logger.error("Rolling back query=\'%s\' due to error: \'%s\'" % (self._queryAsSingleLine(query, qargs), e))
+                self.rollback()
+                return []
 
         if fetch == _FETCH_ONE:
             return self.cursor.fetchone()
@@ -463,9 +465,9 @@ class RADatabase:
         return predIdDict
 
     def getTaskSuccessorIds(self, id=None):
-        query = '''SELECT * from resource_allocation.task_predecessor tp;'''
+        query = '''SELECT * from resource_allocation.task_predecessor tp'''
 
-        if id is not None :
+        if id is not None:
             query += ' WHERE id=%s'
 
         items = list(self._executeQuery(query, [id] if id is not None else None, fetch=_FETCH_ALL))