Django 및 Flask 트랜잭션 롤백

518 단어
딱고의
from django.db import transaction #       
try:
    with transaction.atomic():
        #       ,      ,       
except Exception as err:
    print(err)
else:
    return JsonResponse({'statuscode': '200'})

Flask의
    try:
        #    sql            rollback()          
        connect.commit()
        return 'OK'
    except Exception as error:
        print(error)
        connect.rollback()    #          
        return 'Err'

좋은 웹페이지 즐겨찾기