I have read Django transactions and going to use it in my project but here are few questions that I want to know about it. Actually I want transactions to use while registration, I am doing insert at 2-3 places while registration, so I want that if any query fail, then no insertion should be performed. So according to Django docs, I guess I need to use commit_on_success type of transaction.
But I want to know is these transactions dependents on Database or it is all internal of Django? Whether I need to change DB storage engine for it or not? What if I will have to use it on different storage engines or even in future different Database like one table in SQL and one in nosql? Or this just don’t matter?
Also if I will be using it like:
from django.db import transaction
def function1():
#code here without transaction
@commit_on_success
def function2():
#code here with transaction
Then function 2 will work with commit if all method code will be successful but what will happen with function1 as before it transaction is imported? What type of transaction will be applied on function1 ? I want function1 to not have any transaction but to behave normally as it work in other model of form code so what should I do?
So my questions are that what to do have every thing behave normally without transactions but having one method with transaction? Will it work by using decorator and other methods will behave normally or I will need to do something else? And do these transactions depends upon database and database storage engine like InnoDB too these transactions are just Django internal transactions?
I.e. it is safe to use @commit_on_success in one method. Nothing will break if you will change to DB without transaction support in future.