Hello list,

I am developing a network management system that relies heavily on a
MySQL database. The logic of the program is unavoidably coupled with
query results I get from various tables.

This is OK as long the mysql server has 100% uptime, but it hardly
does. Say that I have to make at least 20 different kinds of queries
here and there in different parts of my code(all together more than a
thousand queries). What is the best approach to make error checking
possible, with the least amount of code duplication?

Right now my code is probably ill-structured in terms of the database
backend. A MySQLdb.connection object is juggled around as an arguement
to my own program's objects, so that they can retrieve the info they
need from the database tables when needed. After a whole program
iteration has finished, the connection object is destroyed and a new
one is cerated for the next iteration.

This means that a 5-minute downtime of the SQL server will cause my
program to crash. It is really too much trouble checking for
exceptions every time I make a simple query. What approach should I
try take?

Thanks a lot. A better backend design will make my application much more robust.

Thanos
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to