def autocommit(data_access):
  """Make statements autocommit.

  :param data_access: a DataAccess instance
  """
  if not data_access.autocommit:
    data_access.commit()
  old_autocommit = data_access.autocommit
  data_access.autocommit = True
  try:
    yield data_access
  finally:
    data_access.autocommit = old_autocommit
Make statements autocommit.

  :param data_access: a DataAccess instance