Why are you interpolating these parameters into the string?

```python
conn.execute('PRAGMA key=?', (passphrase))
```

Also why are you replacing quotes in the passphrase? Lastly, can you just execute statements on a connection object?  I'd think you'd want a cursor instead.