Been round the houses on this one, cant seem to get the right syntax.
All I want to do is insert a row into a table in SQLAlchemy. The documentation doesnt make sense to me thought:
class sqlalchemy.sql.expression.Insert(table, values=None, inline=False, bind=None, prefixes=None, returning=None, **kwargs)
The closest I have come is
userChoices = meta.Session.query(model.CompUserChoices).filter(model.CompUserChoices.inmptl_user_name == postdict['userid']).filter(model.CompUserChoices.inmptl_option_id == postdict['leg']).all()
userChoices.insert({model.CompUserChoices.inmptl_user_name:postdict['userid']},\
{model.CompUserChoices.inmptl_option_id:postdict['leg']},\
{model.CompUserChoices.inmptl_comp_choice_id:newChoices[i]})
Could someone please tell me the correct syntax!
I’m not sure I understand what exactly you are trying to do, but adding a row is usually no harder than creating a model object and adding it to the session.