i have a problem with syntax when i try send method post using python. This is my python function:
def insert_tipo_falla(self,cod_falla,desc_falla):
sql = 'INSERT INTO TipoFallas(cod_tipo_falla,desc_falla) values ({},{})'.format(cod_falla,desc_falla)
try:
self.cursor.execute(sql)
self.connection.commit()
except Exception as e:
raise
finally:
self.connection.close()
Sending with my API this json:
{
"cod_tipo_falla":"104",
"desc_falla":"TAP NIVELES BAJOS"
}
This function send a error when i try to insert with my API:
raise_mysql_exception raise errorclass(errno, errval) pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NIVELES BAJOS)' at line 1")
I check several times, i insert manually way and it works, but using this python function dont it works Thanks and sorry for my english