Migration v12 to13 problem

There was an issue while migrating the DocType: Sales Invoice

Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 306, in migrate
migrate(
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 70, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/sync.py”, line 69, in sync_for
import_file_by_path(doc_path, force=force, ignore_version=True,
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 69, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process,
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 152, in import_doc
doc.insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 268, in insert
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1001, in run_post_save_methods
self.run_method(“on_update”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 860, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1158, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1141, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 854, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 302, in on_update
raise e
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 299, in on_update
frappe.db.updatedb(self.name, Meta(self))
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 297, in updatedb
db_table.sync()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/schema.py”, line 40, in sync
self.alter()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 88, in alter
raise e
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 75, in alter
frappe.db.sql(query)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 153, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 148, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 310, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 775, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 1156, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, “Data too long for column ‘po_no’ at row 1122”)

Were you able to solve this problem, if so please share

what exactly is your error?

Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/erp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/erp/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erp/frappe-bench/apps/frappe/frappe/commands/init.py”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erp/frappe-bench/apps/frappe/frappe/commands/site.py”, line 309, in migrate
migrate(
File “/home/erp/frappe-bench/apps/frappe/frappe/migrate.py”, line 72, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/erp/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/erp/frappe-bench/apps/frappe/frappe/model/sync.py”, line 70, in sync_for
import_file_by_path(doc_path, force=force, ignore_version=True, reset_permissions=reset_permissions)
File “/home/erp/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 130, in import_file_by_path
import_doc(
File “/home/erp/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 257, in import_doc
doc.insert()
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 270, in insert
self.run_post_save_methods()
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 1004, in run_post_save_methods
self.run_method(“on_update”)
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 869, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 1161, in composer
return composed(self, method, *args, **kwargs)
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 1144, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erp/frappe-bench/apps/frappe/frappe/model/document.py”, line 866, in fn
return method_object(*args, **kwargs)
File “/home/erp/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 302, in on_update
raise e
File “/home/erp/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 299, in on_update
frappe.db.updatedb(self.name, Meta(self))
File “/home/erp/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 309, in updatedb
db_table.sync()
File “/home/erp/frappe-bench/apps/frappe/frappe/database/schema.py”, line 41, in sync
self.alter()
File “/home/erp/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 104, in alter
raise e
File “/home/erp/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 91, in alter
frappe.db.sql(query)
File “/home/erp/frappe-bench/apps/frappe/frappe/database/database.py”, line 152, in sql
self._cursor.execute(query)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 148, in execute
result = self._query(query)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/cursors.py”, line 310, in _query
conn.query(q)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 775, in _read_query_result
result.read()
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 1156, in read
first_packet = self.connection._read_packet()
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/connections.py”, line 725, in _read_packet
packet.raise_for_error()
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/protocol.py”, line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File “/home/erp/frappe-bench/env/lib/python3.8/site-packages/pymysql/err.py”, line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.DataError: (1406, “Data too long for column ‘po_no’ at row 5985”)

Is the error during the migration of Sales invoice? If so then It is obvious that the PO number for one of the sales invoice is invalid which is causing this error. You may need to change that value.

I did, inspite of it, i am still getting this error

Try bench migrate --skip-failing and see if it works. If still no luck then you may have to check the database and change the value there.

Thank you very much for your suggestion. I did try those and its still failing. Even when i change the value in the DB and try i am getting the same error.

the error is at the same row even after changing the value or has the row changed?

Login to your database and can you post the results of

select name, po_no from tabSales Invoice;

|GGN/21-22/03069|MSIL/21-22/03971↵MSIL/21-22/03973↵MSIL/21-22/03974↵MSIL/21-22/03975↵MSIL/21-22/03976↵MSIL/21-22/03977↵MSIL/21-22/03978↵MSIL/21-22/03979↵MSIL/21-22/03980↵MSIL/21-22/03981↵MSIL/21-22/03982↵MSIL/21-22/03983↵MSIL/21-22/03984|

This is the row which is giving the problem. I can’t post the whole table as its very very big.!

At least a screenshot. I couldn’t understand as all the data is mixed up in your post.

ok will try to share