Re: [BangPypers] Flask-SQLAlchemy and SQLite

2016-07-28 Thread Balachandran Sivakumar
Hi, On Thu, Jul 28, 2016 at 7:20 PM, Balachandran Sivakumar < benignb...@gmail.com> wrote: > > event.listen(db.get_engine(app), 'connect', enable_fkey) > This worked when I converted this to the decorator style use. Will have to figure out why this did not work later. Thanks -- Thank you Ba

Re: [BangPypers] Flask-SQLAlchemy and SQLite

2016-07-28 Thread Balachandran Sivakumar
Hi, On Thu, Jul 28, 2016 at 7:20 PM, Balachandran Sivakumar < benignb...@gmail.com> wrote: > > > def enable_fkey(dbcon, con_rec): > dbcon.execute('PRAGMA foreign_keys=ON;') I tried creating a cursor and executing on that too. Doesn't seem to work that way either. Thanks -- Thank you B

[BangPypers] Flask-SQLAlchemy and SQLite

2016-07-28 Thread Balachandran Sivakumar
Hi, I am working on creating a website using Flask. We are using the Flask-SQLAlchemy extension for ORM and SQLite for DB. SQLIte doesn't have foreign key constraints enabled by default. They have to be enabled using the PRAGMA foreign_keys = ON; directive on each connection. I am not able