in evalbench/databases/sqlserver.py [0:0]
def _execute_autocommit(self, query: str):
error = None
raw_conn = None
cursor = None
try:
raw_conn = self.engine.raw_connection()
raw_conn.connection.autocommit = True # type: ignore
cursor = raw_conn.cursor()
cursor.execute(query)
except Exception as e:
error = str(e)
finally:
if cursor:
cursor.close()
if raw_conn:
raw_conn.close()
return error is None, error