Can we take advantage of psycopg2's cursor's execute function's ```parameters``` argument here?  See reference [here](http://initd.org/psycopg/docs/cursor.html#cursor.execute).  Should allow something like:
```python
cur.execute("INSERT INTO settings (test, base_data_dir) VALUES "
            "(TRUE, '%(path)s')", {'path': base_data_dir})
```