Diving into Python
Yup, Im now diving into Python. So far, Im loving it. Not as hard as java, very pragmatic programming. I got converted when I saw Awaretek’s “Python Learning Foundation” which I believe deserves a lot of merit for promoting Python. One of the podcasts from www.directionmag.com states that Python is #4 among GIS professional as a must-have progamming language experience.
Moving forward, I kickstarted with a few tutorials. Fast-reading most of the tutorials from http://www.upriss.org.uk/python/PythonCourse.html and trying out the exercises. It was fabolous. Simple yet powerful. Then I saw Alex Martelli’s tutorial from http://www.aleax.it/Python/py25.pdf. Those who have programming experience like Java/C, would benefit much from Martell’s PDF tutorial.
Next stop.. using databases with python.. Head on to the database section of AwareTek.
-
I’ve dowloaded Python’s DB Interface for Postgres ‘psycopg2‘. http://www.initd.org/tracker/psycopg/wiki/PsycopgTwo
-
Steve Holden’s dbPythonIntro.pdf. Presents a quick overview of the DB API. Important pages would be:
- 26/65 Connection Example (includes Postgres)
- 29/65 Connection Methods
- 30/65 Executing Queries
- 31/65 Retrieving Results
- Accessing PostgreSQL with Python and Psycopg2. This three page tutorial will quickly give you a background of how to execute queries, fetch queries using column index or by names.