Working with different SQL implementations can be frustrating: not only are there slight differences in the SQL syntax, but the Python libraries used to connect to them are often inconsistent in the various methods they implement. While, in some ways, it's less convenient than the better-known Python SQL libraries, QtSQL does provide us with a single abstracted API for working with a variety of database products in a consistent way. When leveraged properly, it can also save us a large amount of code.
To learn how to work with SQL data in PyQt, we're going to build a graphical frontend for the coffee database we created in the SQL basics section of this chapter.
A complete version of this database can be created from the sample code using this command:
$ sqlite3 coffee.db -init coffee.sql. You will need to create this database file before...
$ sqlite3 coffee.db -init coffee.sql. You will need to create this database file before...