
上QQ阅读APP看书,第一时间看更新
While the projection specification that we set for ourselves is fulfilled, there is more that can be done on this program to make it more serviceable in a production environment. Some areas that you might look at for further practice are:
- Set the host, database, username, and password from command-line options. You will naturally need to error-check each of them. You will probably want to use the
getpass
module to accept the password in production environments. - Set an option for the column variable and testing whether that column exists in the chosen database.
- Set up error-checking for the results itself.
The world
database has a few other tables besides City
. Can you aggregate their records in Python without using a JOIN
statement?