Survival guide to Python used with SQL

Step 1 in learning to use Python and database systems, is to
start Python in interactive mode and play with it. This is
done by typing Python on the command line. Of course you need
a computer with Python installed. If you have a Mac running OS
X, the command line is accessed from the Terminal Window
Utility. You can also simply connect to your account on
mscs.ltu.edu You might want to install it on Windows laptop.
Directions for doing this are in the handout on Perl, Python and Ruby.

Remember that blocks in Python are all the lines indented the
same after a : in a flow control statement. Thus Python is the
only one of the scripting languages descended from C where
whitespace is important to the compiler. For help with basic,
non database, programming tasks in Python see the Phrasebook in the handouts.

A sample interactive session in Python on a Windows laptop that
also has MySQL and PostgreSQL installed and has the datasets of
Exercises 5.1-5 from Ramakrishnan loaded into both MySQL and
PostgreSQL. The datasets and directions for loading them are
in the handout on Ramakrishnan's
Exercises 5.1 through 5.5.

Windows user interface. Python has at least 2 pathways that
may interest you for desktop windowing user interfaces. If
your need is only for the Windows platform and you already
understand the MFC framework for C++, you can use the PyC...
wrapper classes for MFC that come with Active State's Python
Win32 extentions. The more portable Tk framework also works with
Mac OS X and Unix X-windows systems. Because most of the
current development in Tcl/Tk is also at Active State, Tk seems
like the more stable choice. If you need to do a lot of
windowing work, you will want to look at the help files that
come from Active State for lots of nice examples of how to
use classes in Python with Tkinter.

A subroutine example. If there were a table "kit" added to the
Exercise 5.2 dataset, with columns:
kit-part-id, component-part-id, component-quantity, ...
then a simple subroutine to test if any part-id is a kit, by
checking if at least 1 row has that value