Fun at PyOhio: SqlAlchemy, MongoDB, and Google Maps API

ThoughtsTips and Tricks

This was my first year attending PyOhio, and I really enjoyed it. It was small enough to have the time to catch up with fellow Python geeks, yet large enough to offer interesting and wide-ranging topics.

I did a tutorial on browser-to-database web development in Python, using components from various packages instead of one framework. I found myself and Mark Ramm giving our audiences a common message about frameworks in general, which was (1) each framework has limitations, (2) know these limitations before running off to use them. It was comforting to know that I am not the only one trying to convey this message.

I wasn’t quite sure how long my tutorial would run, so the PyOhio folks were kind enough to give me a room for an entire afternoon. It took about three hours, and was great fun.

I’ll attach all slides, links, and code. But there’s the summary of it all.

I took weather data from the University of Delaware, air temperatures from around the world ranging from 1900 to 2008. I pulled the data into both SqlAlchemy/Postgres, and MongoDB (a BSON-based key-value object store).

I then used CherryPy to serve up the data. My templates are written in template, generating Google Map data.

The first CherryPy daemon takes longitude and latitude, and allows you to choose between Postgres or Mongo:

The second daemon provided a simple form, accepting zip codes, and referencing a database which maps zip codes to longitude and latitude.

Feel free to play with the links for a bit longer. They will be coming down in the next month or so.

The code and data, including all CSV load code and scripts, exists here:

Shoot me an email for the login and password: gloriajw_66 at yahoo dot com

This is an excellent web app example for learning purposes.

The tutorial is also somewhere on BlipTV, I am told.

Enjoy, play, ask questions.


2 Responses to “Fun at PyOhio: SqlAlchemy, MongoDB, and Google Maps API”

  1. mike bayer

    1. the code download link is asking for a password

    2. need some help optimizing the PG query ? you can’t tell me that postgresql takes nearly 5 seconds to load a small set of numbers (the mongo version takes .3).

  2. Gloria

    Hi Mike,
    I sent you email, check yourr inbox.
    The PG slowness may be due to the fact that it is pulling a small amount of records from many.

    I realize that a key-value store will always be faster than Postgresql, so maybe it is unfair to compare them? A more accurate comparison may be MySQL with no additional keys and innodb ?


Leave a Reply