view.py is as follows:
.
c_location = request.form.getlist ("centering location")
connection = db.engine.connect()
mysql = text(
"INSERT INTO livingexpenses_coal (c_location) values (:m);"
)
result = connection.execute(mysql,m=c_location)
.
now an error has been reported:
sqlalchemy.exc.OperationalError: (_ mysql_exceptions.OperationalError) (1241, "Operand should contain 1 column (s)") [SQL: "INSERT INTO livingexpenses_coal (c_location) values (% s);"] [parameters: (["1asdfeld," 5"])] (Background on this error at: http://sqlalche.me/e/e3q8)
that is, c_location is now an array and cannot input values, but the normal sql statement can use:
INSERT INTO table name (column name, column name) VALUES (column value, column value), (column value); to insert multiple data at one time. Please tell me how to modify my code. Thank you very much.