UDST / spandex

Spatial Analysis and Data Extraction
http://nbviewer.ipython.org/github/synthicity/user_meeting_2014/blob/gh-pages/spandex/spandex_demo.ipynb
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Add database connection manager #13

Closed jiffyclub closed 10 years ago

jiffyclub commented 10 years ago

So we can drop dependency on urbansim.

Before using the database you should open a connection to it:

from spandex.database import database as db

db.connect('connection details')

From then on the internal spandex code will then use the same object and it's stored connection for all database communication, taking advantage of psycopg2's automatic commit and rollback logic.

jiffyclub commented 10 years ago

@janowicz, I haven't set up a working database with data yet so I haven't tested this. If you or @conorhenley could do me a favor and check out this branch and try to run some of the notebooks and make sure nothing is broken I'd appreciate it.

Or I can try it out tomorrow with the loading and everything.

janowicz commented 10 years ago

Tested it by running the spatial_demo notebook, and it works great! Thanks Matt!