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

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -