I’ve trying to insert a new value to a doctype, creating a new docfield, but it’s giving me the folowing error:
Traceback (most recent call last):
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/document.py”, line 223, in save
return self._save(*args, **kwargs)
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/document.py”, line 266, in _save
self.db_update()
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 338, in db_update
), d.values() + [name])
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File “/home/xpelite-02/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/xpelite-02/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
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 '), owner
=‘Administrator’, docstatus
=0, parentfield
=NULL where name=‘267002’ at line 2”)
Traceback (most recent call last):
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/app.py”, line 55, in application
response = frappe.handler.handle()
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/handler.py”, line 19, in handle
execute_cmd(cmd)
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/handler.py”, line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/init.py”, line 895, in call
return fn(*args, **newargs)
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/document.py”, line 223, in save
return self._save(*args, **kwargs)
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/document.py”, line 266, in _save
self.db_update()
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 338, in db_update
), d.values() + [name])
File “/home/xpelite-02/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File “/home/xpelite-02/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/xpelite-02/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
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 '), owner
=‘Administrator’, docstatus
=0, parentfield
=NULL where name=‘267002’ at line 2”)
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
the sql statement that I’m trying is:
frappe.db.sql(“”“insert into tabDoctype(fieldname) values(‘value’)”“”)
//frappe.db.sql(“”“insert into tabnombre(nombre) values(‘manuel’)”“”)
Where my doctype’s name is nombre and I want to set the value od the field ‘nombre’ to manuel
Can anyone help me please???