Finally, we should return Python's attention from the main() function and finish off the program.
returnAs usual, the last loop evaluates the runtime command from the user and passes Python's attention to main().
if __name__ == '__main__':
main()
One can now call the program with the necessary four arguments.
python ./readpostgresql.py cornucopia id > 0The results are tasty:
(1, 'banana')
(2, 'kiwi')
(3, 'nectarine')
Using this knowledge, you can easily automate access to several PostgreSQL databases and collate the data for any purpose. With my tutorial on inserting data, one can even create new databases "automagically".


