Skip to content
Advertisement

Raw “Insert” SQL in SQLAlchemy, Flask

Values are not added to the database after INSERT query. SELECT is working fine this way

  db = SQLAlchemy(app)
  ...
  session['sql_raw_reports_post'] = "insert into database (x, y) values (xa, ya)"
  r = db.session.execute(session['sql_raw_reports_post'])
  ...
  return 'success'

Advertisement

Answer

you can try add

db.commit()

ater “insert” action

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement