python - How can I view queries used for .create or .save without executing -


i want able retrieve sql statement being executed when calling

mymodel(**kawrgs).save() 

or

mymodel.objects.create(**kwargs) 

but without creating object in database. know can access queries via django.db.connection.queriesand querysetobject.sql, , guess using transactions in way may useful, seems bit on head.

any suggestions?

thanks!

a.

you figure out method called in inner workings of save() or create() run final sql statement against database (probably in db backend cursor.execute()) , use mock library prevent being executed , capture it's arguments instead.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -