How to code a django site efficiently while accessing database using MySQLdb?
It's down to preference but personally I try to catch all potential errors, you never know what other issues they might expose.
And ofcourse, there's the "Zen of Python": "Errors should never pass silently.
Unless explicitly silenced"
Now i am developing a website in django. But i used MySQLdb to connect with the database instead of django ORM since django ORM doesn't support multiple keys.
I will explain my question with a example, consider i am writing a dictionary to database having type longtext. Hence i have used json.dumps() method to write database.
I am reading those field using another url, hence while coding view function for reading i have used json.loads() method to get the dictionary back and here is my question arise. Whether i need to handle the exception when database field hold a non json string. If database field hold a non json string json.loads() will produce ValueError.
Whether i need to catch those type of error since chance of having database with non json string is very little.