title: flask sqlite cannot delete rows from database
body: <p>I cant seem to delete rows from sqlite database when using flask</p>
  
  <pre><code>@app.route('/deletePath',methods=['POST'])
      def deletePath():
          if 'toDelPathIndex' in request.form:
              pathIndex = request.form['toDelPathIndex']
              if not isInt(pathIndex):
                      errorMessage="Given Path Index "+pathIndex+" is not valid"
                      return render_template('addPath.html',error=errorMessage)
  
              cur = g.db.cursor()
              cur.execute('select id,ParentDir from Path')
              rows=cur.fetchall()
              found=0
              for row in rows:
                      if int(pathIndex) == row[0]:
                              Dir=row[1]
                              found = 1
              if found == 0:
                      errorMessage="Given Path Index "+pathIndex+" is not present in database"
                      return render_template('addPath.html',error=errorMessage)
              g.db.execute('delete from Path where id=' + pathIndex)
              g.db.commit()
              g.db.execute('delete from SnippetDirs where ParentDir=?',(Dir,))
              g.db.commit()
              return redirect(url_for('addPath_GET'))
      else:
                      errorMessage="Please give me a path index to try and delete"
                      return render_template('addPath.html',error=errorMessage)
  </code></pre>
  
  <p>More specifically this line</p>
  
  <pre><code>g.db.execute('delete from SnippetDirs where ParentDir=?',(Dir,))
  </code></pre>
  
  <p>is not working as expected because the size of the database is not decreasing
  whereas this line</p>
  
  <pre><code>g.db.execute('delete from Path where id=' + pathIndex)
  </code></pre>
  
  <p>is executing correctly and deleting the required row from one of the table.</p>
  
  <p>I dont know what i am doing wrong</p>