def _query_and_fetchall(self, query):
    'Creates a new connection, executes a query and fetches all the results.\n        \n        :param query: query to execute\n        :return: all fetched results as returned by cursor.fetchall()\n        '
    with self._connect() as conn:
        cur = conn.cursor()
        cur.execute(query)
        results = cur.fetchall()
    return results
Creates a new connection, executes a query and fetches all the results.

:param query: query to execute
:return: all fetched results as returned by cursor.fetchall()
def _query_and_fetchall(self, query):
    'Creates a new connection, executes a query and fetches all the results.\n        \n        :param query: query to execute\n        :return: all fetched results as returned by cursor.fetchall()\n        '
    with self._connect() as conn:
        cur = conn.cursor()
        cur.execute(query)
        results = cur.fetchall()
    return results