|
From: Mike T. <mik...@gm...> - 2005-02-21 16:57:09
|
Overall it looks pretty good, but what is with the triple double-quotes? A couple of suggestions: Line 81: If you want to assure that you only get one record back from the troops table with that name then you can put a unique key constraint on the field or you can do LIMIT 1 at then end of the query... or you can add other filters to make sure you will always only get back one record. Line 90: Instead of fetching x records with just an id in it from scouts in the database so that you can go back and fetch the firstname, lastname, birthdate for each of those ids, just SELECT * FROM scouts WHERE troop_id = some_id. Then loop on those records that you get back and you will have everything you need with one query. If you did it the way you did to save speed, then don't worry about that. Unless you have a lot of text fields in a record set, then selecting anything other than * is miniscully faster. - You may want to get into the habit of writing your SQL keywords in all caps. - You don't have to encapsulate your filter values in your WHERE clause in single quotes if you filtering by an integer. You can just use the value directly. You may want to use %d for the ints if python supports it Do you know if you can call class methods statically in python? |