Error while making bench migrate

Hello guys.
Previously I used ERPNext from VM image provided by team. I made a backup of database in VM and now trying to restore it to ubuntu setup(installed by easy install script).

**`bench --site site1.local --force restore ~/database.sql`** command ends successfully without any error. After running **`bench migrate`** it gives my this error:
~/frappe-bench$ bench migrate
Migrating erpn
Updating frappe                     : [=                                       ]Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/haci/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/haci/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/haci/frappe-bench/apps/frappe/frappe/commands.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/haci/frappe-bench/apps/frappe/frappe/commands.py", line 205, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/haci/frappe-bench/apps/frappe/frappe/migrate.py", line 29, in migrate
    frappe.model.sync.sync_all(verbose=verbose)
  File "/home/haci/frappe-bench/apps/frappe/frappe/model/sync.py", line 19, in sync_all
    sync_for(app, force, verbose=verbose)
  File "/home/haci/frappe-bench/apps/frappe/frappe/model/sync.py", line 43, in sync_for
    import_file_by_path(doc_path, force=force)
  File "/home/haci/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 54, in import_file_by_path
    import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
  File "/home/haci/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 122, in import_doc
    doc.insert()
  File "/home/haci/frappe-bench/apps/frappe/frappe/model/document.py", line 203, in insert
    self.db_insert()
  File "/home/haci/frappe-bench/apps/frappe/frappe/model/base_document.py", line 282, in db_insert
    ), d.values())
  File "/home/haci/frappe-bench/apps/frappe/frappe/database.py", line 136, in sql
    self._cursor.execute(query, values)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/haci/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, "Column 'track_seen' cannot be null")

I could find ‘track_seen’ entry only in tabDocType table and non of fields are null, they are either 0 or 1.
Can you please help me. Thank you.

Looks like you have restored a database which was patched using a develop branch, into a bench with all apps in master branch.

You will need to either change your app branches to develop, or create a new bench with develop branch apps and move the site to that new bench.

1 Like

Thank you @anand, it was exactly as you wrote. In VM downloaded from your site bench and ERPNext were in master branch, but frappe was on develop. On ubuntu setup all were in master. I didn’t chage branch in VM, just made few times bench update. So is default combination is master master devolop for bench ERPNext and frappe? And what combo should I use for everyday stable setup?

1 Like

Use master branch for all repos

@valmik can you look into the VM?

1 Like

Could you please explain how should I patch or convert database to be able to use it in master branch?
In VM I tried bench switch-to-master and bench update --patch, it gives me the same error as above.
Thank you for your effort.

Hey @Hadzhi,

Sorry for the trouble, the VM is supposed to be on the master branch, however, something went awry and the Frappe branch turned out to be on develop. I’ve fixed that issue. However, because of the database differences of master and develop, you’re facing this issue.

Now, this is how you can fix it, I’m assuming both your frappe and erpnext are in the master branch :

  1. Take a backup
  2. First do a bench update. It will break and give an error, that’s fine.
  3. Run bench mysql. You should get in the MySQL shell
  4. Run ALTER TABLE tabDocType DROP COLUMN track_seen;
  5. And then run ALTER TABLE tabDocType DROP COLUMN quick_entry;
  6. Exit the SQL terminal, and run bench update
  7. Access your ERPNext to check if everything is working fine
  8. Take new backup and use that for new setup
4 Likes

Thank you @vjFaLk, now all works fine on master branch without any issue.
I am very glad that this team has professional developers like you guys. Keep up this awesome project.

Glad to be of help! :smiley:

Let us know if you have any other issues

1 Like

@vjFaLk.I am also have same issue…

ikhlas@ikhlas:~$ cd frappe-bench
ikhlas@ikhlas:~/frappe-bench$ bench update
remote: Counting objects: 638, done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 638 (delta 507), reused 483 (delta 481), pack-reused 85
Receiving objects: 100% (638/638), 242.11 KiB | 26 KiB/s, done.
Resolving deltas: 100% (513/513), completed with 161 local objects.
From https://github.com/frappe/frappe
   70a4e33..cdddec0  master     -> upstream/master
   9c7d1f2..f025f15  develop    -> upstream/develop
   cc11832..984ec6c  gh-pages   -> upstream/gh-pages
   f85f2f5..cdddec0  hotfix     -> upstream/hotfix
 * [new tag]         v6.27.13   -> v6.27.13
From https://github.com/frappe/frappe
 * [new tag]         v6.27.11   -> v6.27.11
 * [new tag]         v6.27.12   -> v6.27.12
INFO:bench.utils:updating bench
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/frappe/bench
   4d90001..ccea825  develop    -> origin/develop
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Updating 70a4e33..cdddec0
Fast-forward
 frappe/__init__.py                                 |    5 +-
 frappe/__version__.py                              |    2 +-
 frappe/change_log/v6/v6_27_11.md                   |    2 +
 .../core/doctype/communication/communication.json  | 1964 ++++++++++----------
 frappe/core/doctype/communication/communication.py |   42 +-
 frappe/core/doctype/communication/email.py         |   31 +-
 frappe/core/doctype/role/role.json                 |   35 +-
 frappe/core/doctype/role/role.py                   |    8 +
 frappe/core/doctype/role/test_records.json         |    4 +
 frappe/core/doctype/role/test_role.py              |   24 +-
 frappe/core/doctype/user/user.py                   |   15 +-
 frappe/docs/_config.yml                            |    2 -
 frappe/docs/user/en/tutorial/index.md              |    3 -
 frappe/email/bulk.py                               |   31 +-
 frappe/email/doctype/bulk_email/bulk_email.json    |   30 +-
 frappe/email/email_body.py                         |   46 +-
 frappe/email/smtp.py                               |   60 +-
 frappe/hooks.py                                    |    2 +-
 frappe/public/js/frappe/form/footer/timeline.js    |   70 +
 .../js/frappe/form/footer/timeline_item.html       |    2 +
 frappe/public/js/frappe/model/model.js             |   47 -
 frappe/public/js/frappe/views/formview.js          |    8 +-
 setup.py                                           |    2 +-
 23 files changed, 1325 insertions(+), 1110 deletions(-)
 create mode 100644 frappe/change_log/v6/v6_27_11.md
 delete mode 100644 frappe/docs/_config.yml
INFO:bench.app:pulling erpnext
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (15/15), done.
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Updating 4058af2..1843359
Fast-forward
 erpnext/__version__.py             |    2 +-
 erpnext/crm/doctype/lead/lead.json |    4 ++--
 erpnext/hooks.py                   |    2 +-
 setup.py                           |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
INFO:bench.app:pulling schools
remote: Counting objects: 30, done.
remote: Compressing objects: 100% (18/18), done.
Unpacking objects: 100% (30/30), done.
remote: Total 30 (delta 18), reused 9 (delta 9), pack-reused 3
From https://github.com/frappe/schools
 * branch            develop    -> FETCH_HEAD
Updating b4d67b8..a867820
Fast-forward
 .travis.yml             |    6 +++---
 schools/setup_wizard.py |   26 ++++++++++++++++++--------
 2 files changed, 21 insertions(+), 11 deletions(-)
INFO:bench.app:pulling s3_backup
From https://github.com/ccfiel/s3_backup
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling mandrill_integration
From https://github.com/frappe/mandrill_integration
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling paypal_integration
From https://github.com/frappe/paypal_integration
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext_shopify
From https://github.com/frappe/erpnext_shopify
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling civil_contracting
From https://github.com/revant/civil_contracting
 * branch            master     -> FETCH_HEAD
Already up-to-date.
/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
Migrating civil
Updating frappe                     : [========================================]
Updating civil_contracting          : [========================================]
Migrating erp
Updating frappe                     : [========================================]
Migrating sunerp
Executing frappe.patches.v5_0.style_settings_to_website_theme in sunerp (8f16163e62)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/commands.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/commands.py", line 205, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/patches/v5_0/style_settings_to_website_theme.py", line 10, in execute
    migrate_style_settings()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/patches/v5_0/style_settings_to_website_theme.py", line 28, in migrate_style_settings
    website_theme.use_theme()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 55, in use_theme
    use_theme(self.name)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/doctype/website_theme/website_theme.py", line 62, in use_theme
    website_settings.save()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 244, in save
    self.run_before_save_methods()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 617, in run_before_save_methods
    self.run_method("validate")
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 579, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 735, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 718, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/model/document.py", line 573, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py", line 17, in validate
    self.validate_home_page()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py", line 22, in validate_home_page
    if self.home_page and not resolve_route(self.home_page):
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/router.py", line 46, in resolve_route
    return get_generator_route(path)
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/router.py", line 57, in get_generator_route
    generator_routes = get_generator_routes()
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/website/router.py", line 84, in get_generator_routes
    {2}""".format(route_column_name, doctype, condition), as_dict=True):
  File "/home/ikhlas/frappe-bench/apps/frappe/frappe/database.py", line 147, in sql
    self._cursor.execute(query)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ikhlas/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1054, "Unknown column 'page_name' in 'field list'")
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==2.0.0', 'console_scripts', 'bench')()
  File "/home/ikhlas/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click-6.4-py2.7.egg/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click-6.4-py2.7.egg/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click-6.4-py2.7.egg/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click-6.4-py2.7.egg/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click-6.4-py2.7.egg/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ikhlas/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/ikhlas/bench-repo/bench/commands/update.py", line 90, in _update
    patch_sites(bench=bench_path)
  File "/home/ikhlas/bench-repo/bench/utils.py", line 131, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench=bench)
  File "/home/ikhlas/bench-repo/bench/utils.py", line 454, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')
ikhlas@ikhlas:~/frappe-bench$

While changing branch develop (frappe v7 beta) to master (v6 stable) might encounter following errors:

Solution 1:

Error:

_mysql_exceptions.OperationalError: (1048, "Column 'image_view' cannot be null")

Fix:

$ bench mysql
$ ALTER TABLE tabDocType DROP COLUMN image_view;
$ exit

Error:

_mysql_exceptions.OperationalError: (1048, "Column 'beta' cannot be null")

Fix:

$ bench mysql
$ ALTER TABLE tabDocType DROP COLUMN beta;
$ exit

Solution 2:

Restoring Database backup from frappe-bench/sites/**your-site-name**/private/backup/ directory with sql.gz files from backdate, if you earlier was on master branch / installed ERPNext in Production mode.

frappe@your-server-name:~$ cat frappe-bench/sites/your-site-name/site_config.json      ##to find database name
{
 "auto_update": "off", 
 "db_name": "07ea370613", ##<----- Database name 
 "db_password": "xxxxxxxxxxxxxxxx", 
 "encryption_key": "e7KIEezFgBGMNPFu-xxxxxxxxxxxxxxxxxxxxxxxxxx=", 
 "host_name": "xxxxxx", 
 "nginx_port": xxxx
}
frappe@your-server-name:~$ cp frappe-bench/site/your-site-name/private/backups/database_file_name.sql.gz ~/database_file_name.sql.gz
frappe@your-server-name:~$ gzip -d database_file_name.sql.gz
frappe@your-server-name:~$ pv database_file_name.sql | mysql -u root -p database_name
## OR if pv is not installed on your machine
frappe@your-server-name:~$ mysql -u root -p database_name < database_file_name.sql
## Both mysql commands will overwrite your existing database, use it with care!!! make sure to backup before applying commands!!!

Note:

  • Assuming you are already logged into frappe user / custom username used while installing bench on your system.

vishal@vishal-K53SC:~/frappe-bench$ bench migrate
Migrating test_awfis
Updating frappe : [======================================= ]Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/vishal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/vishal/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/vishal/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/vishal/frappe-bench/apps/frappe/frappe/commands/site.py”, line 207, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/vishal/frappe-bench/apps/frappe/frappe/migrate.py”, line 29, in migrate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/vishal/frappe-bench/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose)
File “/home/vishal/frappe-bench/apps/frappe/frappe/model/sync.py”, line 43, in sync_for
import_file_by_path(doc_path, force=force)
File “/home/vishal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 54, in import_file_by_path
import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
File “/home/vishal/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 122, in import_doc
doc.insert()
File “/home/vishal/frappe-bench/apps/frappe/frappe/model/document.py”, line 227, in insert
d.db_insert()
File “/home/vishal/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 284, in db_insert
), d.values())
File “/home/vishal/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/vishal/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1048, “Column ‘is_custom’ cannot be null”)
vishal@vishal-K53SC:~/frappe-bench$ bench mysql

i got this same error when upgrading v7 to v9
what have i do next ?
/home/frappe/frappe-bench# sudo bench update INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream master
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    INFO:bench.app:pulling erpnext
    INFO:bench.utils:git pull upstream master
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch master → FETCH_HEAD
    Already up-to-date.
    INFO:bench.utils:find . -name “*.pyc” -delete
    Updating Python libraries…
    INFO:bench.utils:./env/bin/pip install --upgrade pip
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
    INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    Updating node libraries…
    INFO:bench.utils:npm install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
    npm WARN frappe@ No description
    Backing up sites…
    Patching sites…
    Migrating site1.local
    Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘doctype’, force=True) #2017-09-22 in site1.local (1bd3e0294da19198)
    Success
    Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘docfield’, force=True) #2017-03-03 in site1.local (1bd3e0294da19198)
    Success
    Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘docperm’) #2017-03-03 in site1.local (1bd3e0294da19198)
    Success
    Executing execute:frappe.reload_doc(‘core’, ‘doctype’, ‘module_def’) #2017-09-22 in site1.local (1bd3e0294da19198)
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 217, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 31, in migrate
    frappe.modules.patch_handler.run_all()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
    if not run_single(patchmodule = patch):
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 81, in execute_patch
    exec(patchmodule.split(“execute:”)[1],globals())
    File “”, line 1, in
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 691, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 146, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 19, in import_files
    reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 131, in import_doc
    doc.insert()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 237, in insert
    d.db_insert()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 299, in db_insert
    ), list(d.values()))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 152, in sql
    self._cursor.execute(query, values)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
    self.errorhandler(self, exc, value)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
    raise errorclass, errorvalue
    _mysql_exceptions.OperationalError: (1048, “Column ‘is_custom’ cannot be null”)
    root@ip-172-31-34-78:/home/frappe/frappe-bench# bench --force --site site1.local reload-doc schools doctype student_batch_name
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 248, in reload_doc
    frappe.reload_doc(module, doctype, docname, force=context.force)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 691, in reload_doc
    return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 146, in reload_doc
    return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 19, in import_files
    reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 24, in import_file
    ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
    ignore_version=ignore_version, reset_permissions=reset_permissions)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 131, in import_doc
    doc.insert()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 237, in insert
    d.db_insert()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 299, in db_insert
    ), list(d.values()))
    File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 152, in sql
    self._cursor.execute(query, values)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
    self.errorhandler(self, exc, value)
    File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
    raise errorclass, errorvalue
    _mysql_exceptions.OperationalError: (1048, “Column ‘is_custom’ cannot be null”)

Is this issue resolved ?

check out this

Worked like a charm for me. Although I could not pinpoint the offending column, so I had to use this little morsel of wisdom:

SELECT DISTINCT TABLE_NAME 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('is_custom')
AND TABLE_SCHEMA='YourDatabase';

I then ranch bench update, and it ran OK, but had trouble with this:

INFO:bench.utils:sudo supervisorctl restart frappe:
unix:///var/run/supervisor.sock no such file

Which I solved with this:

sudo service supervisor restart

Followed by this:
bench restart

FYI I was updating from 7.0.25 to v10!
Worked flawlessly!

1 Like

Thanks this helped me to solve the issue

but i got this error when in bench upate

 Document has been modified after you have opened it (2018-01-05 10:54:26.006028, 2018-01-05 10:54:26.407987). Please refresh to get the latest document

please help me to solve this issue

Migrating rawscholar1.frappe.cloud
Updating DocTypes for frappe : [========================================] 100%
Updating DocTypes for rawscholar : [========================================] 100%

Traceback with variables (most recent call last):
File “”, line 198, in _run_module_as_main
mod_name = ‘frappe.utils.bench_helper’
alter_argv = True
mod_spec = ModuleSpec(name=‘frappe.utils.bench_helper’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, origin=‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’)
code = <code object at 0x235e050, file “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 1>
main_globals = {‘name’: ‘main’, ‘doc’: None, ‘package’: ‘frappe.utils’, ‘loader’: <_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, ‘spec’: ModuleSpec(name=‘frappe.utils.bench_helper’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, origin=‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’), ‘annotations’: {}, ‘builtins’: <module ‘builtins’ (built-in)>, ‘file’: ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’, ‘cached’: ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/pycache/bench_helper.cpython-311.pyc’, ‘importlib’: <module ‘importlib’ from ‘/usr/lib/python3.11/importlib/init.py’>, ‘json’: <module ‘json’ from ‘/usr/lib/python3.11/json/init.py’>, ‘os’: <module ‘os’ (frozen)>, ‘traceback’: <module ‘traceback’ from ‘/usr/lib/python3.11/traceback.py’>, ‘warnings’: <module ‘warnings’ from ‘/usr/lib/python3.11/warnings.py’>, ‘Path’: <class ‘pathlib.Path’>, ‘de…
File “”, line 88, in _run_code
code = <code object at 0x235e050, file “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 1>
run_globals = {‘name’: ‘main’, ‘doc’: None, ‘package’: ‘frappe.utils’, ‘loader’: <_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, ‘spec’: ModuleSpec(name=‘frappe.utils.bench_helper’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, origin=’/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’), ‘annotations’: {}, ‘builtins’: <module ‘builtins’ (built-in)>, ‘file’: ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’, ‘cached’: ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/pycache/bench_helper.cpython-311.pyc’, ‘importlib’: <module ‘importlib’ from ‘/usr/lib/python3.11/importlib/init.py’>, ‘json’: <module ‘json’ from ‘/usr/lib/python3.11/json/init.py’>, ‘os’: <module ‘os’ (frozen)>, ‘traceback’: <module ‘traceback’ from ‘/usr/lib/python3.11/traceback.py’>, ‘warnings’: <module ‘warnings’ from ‘/usr/lib/python3.11/warnings.py’>, ‘Path’: <class ‘pathlib.Path’>, ‘de…
init_globals = None
mod_name = ‘main
mod_spec = ModuleSpec(name=‘frappe.utils.bench_helper’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>, origin=’/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’)
pkg_name = ‘frappe.utils’
script_name = None
loader = <_frozen_importlib_external.SourceFileLoader object at 0x7fdf5150fad0>
fname = ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py’
cached = ‘/home/frappe/frappe-bench/apps/frappe/frappe/utils/pycache/bench_helper.cpython-311.pyc’
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 114, in
main()
…skipped… 27 vars
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
commands = {‘frappe’: , ‘get-frappe-commands’: , ‘get-frappe-help’: }
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
self =
args = ()
kwargs = {‘prog_name’: ‘bench’}
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
self =
args = [‘frappe’, ‘–site’, ‘rawscholar1.frappe.cloud’, ‘migrate’, ‘–skip-search-index’]
prog_name = ‘bench’
complete_var = None
standalone_mode = True
windows_expand_args = True
extra = {}
ctx = <click.core.Context object at 0x7fdf4ffdd590>
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
self =
ctx = <click.core.Context object at 0x7fdf4ffdd590>
_process_result = <function MultiCommand.invoke.._process_result at 0x7fdf50630e00>
args = [‘migrate’, ‘–skip-search-index’]
cmd_name = ‘frappe’
cmd =
sub_ctx = <click.core.Context object at 0x7fdf4ff79450>
class = <class ‘click.core.MultiCommand’>
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
self =
ctx = <click.core.Context object at 0x7fdf4ff79450>
_process_result = <function MultiCommand.invoke.._process_result at 0x7fdf50630d60>
args =
cmd_name = ‘migrate’
cmd =
sub_ctx = <click.core.Context object at 0x7fdf4ffdda10>
class = <class ‘click.core.MultiCommand’>
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
self =
ctx = <click.core.Context object at 0x7fdf4ffdda10>
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
_Context__self = <click.core.Context object at 0x7fdf4ffdda10>
_Context__callback = <function migrate at 0x7fdf4ff86e80>
args = ()
kwargs = {‘skip_search_index’: True, ‘skip_failing’: False}
ctx = <click.core.Context object at 0x7fdf4ffdda10>
File “/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/decorators.py”, line 33, in new_func
return f(get_current_context(), *args, **kwargs)
args = ()
kwargs = {‘skip_search_index’: True, ‘skip_failing’: False}
f = <function migrate at 0x7fdf4ff86c00>
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
ctx = <click.core.Context object at 0x7fdf4ffdda10>
args = ()
kwargs = {‘skip_search_index’: True, ‘skip_failing’: False}
profile = False
f = <function migrate at 0x7fdf4ff86b60>
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 616, in migrate
).run(site=site)
context = {‘sites’: [‘rawscholar1.frappe.cloud’], ‘force’: False, ‘verbose’: False, ‘profile’: False}
skip_failing = False
skip_search_index = True
activate_by_import = <module ‘traceback_with_variables.activate_by_import’ from ‘/home/frappe/frappe-bench/env/lib/python3.11/site-packages/traceback_with_variables/activate_by_import.py’>
SiteMigration = <class ‘frappe.migrate.SiteMigration’>
site = ‘rawscholar1.frappe.cloud’
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 187, in run
self.post_schema_updates()
self = <frappe.migrate.SiteMigration object at 0x7fdf4e061d10>
site = ‘rawscholar1.frappe.cloud’
filelock = <function filelock at 0x7fdf4dd80f40>
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 52, in wrapper
raise e
args = (<frappe.migrate.SiteMigration object at 0x7fdf4e061d10>,)
kwargs = {}
method = <function SiteMigration.post_schema_updates at 0x7fdf4dd80ae0>
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 44, in wrapper
ret = method(*args, **kwargs)
args = (<frappe.migrate.SiteMigration object at 0x7fdf4e061d10>,)
kwargs = {}
method = <function SiteMigration.post_schema_updates at 0x7fdf4dd80ae0>
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 140, in post_schema_updates
sync_fixtures()
self = <frappe.migrate.SiteMigration object at 0x7fdf4e061d10>
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 22, in sync_fixtures
import_fixtures(app)
app = ‘rawscholar’
apps = [‘frappe’, ‘rawscholar’]
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/fixtures.py”, line 41, in import_fixtures
import_doc(file_path)
app = ‘rawscholar’
fixtures_path = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures’
fixture_files = [‘courses.json’, ‘workspace.json’, ‘number_card.json’, ‘attachment_type.json’, ‘custom_docperm.json’, ‘countries.json’, ‘qualification_type.json’, ‘role.json’, ‘university.json’]
fname = ‘courses.json’
file_path = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py”, line 265, in import_doc
import_file_by_path(
path = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’
pre_process = None
files = [‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’]
f = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 146, in import_file_by_path
import_doc(
path = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’
force = True
data_import = True
pre_process = None
ignore_version = None
reset_permissions = True
docs = [{‘branch’: ‘Dental Anatomy’, ‘course’: ‘Dental Nursing’, ‘docstatus’: 0, ‘doctype’: ‘Courses’, ‘duration’: ‘24 Months’, ‘exam_accepted’: None, ‘fee’: ‘₹12.37 L/yr’, ‘level’: ‘Diploma’, ‘mode’: ‘Full time’, ‘modified’: ‘2024-06-18 13:53:55.754267’, ‘name’: ‘COR-0001’, ‘university’: ‘Trinity College Dublin’, ‘__islocal’: 1}, {‘branch’: ‘History’, ‘course’: ‘BA Hons History of Art and Architecture JH’, ‘docstatus’: 0, ‘doctype’: ‘Courses’, ‘duration’: ‘48 Months’, ‘exam_accepted’: None, ‘fee’: ‘₹18.00 L/yr’, ‘level’: ‘UG’, ‘mode’: ‘Full time’, ‘modified’: ‘2024-06-18 13:53:55.816026’, ‘name’: ‘COR-0002’, ‘university’: ‘Trinity College Dublin’, ‘__islocal’: 1}, {‘branch’: ‘Foreign Language’, ‘course’: ‘BA Hons German JH’, ‘docstatus’: 0, ‘doctype’: ‘Courses’, ‘duration’: ‘48 Months’, ‘exam_accepted’: None, ‘fee’: ‘₹18.51 L/yr’, ‘level’: ‘UG’, ‘mode’: ‘Full time’, ‘modified’: ‘2024-06-18 13:53:55.944796’, ‘name’: ‘COR-0003’, ‘university’: ‘Trinity College Dublin’, ‘__islocal’: 1}, {'branch…
calculated_hash = ‘c0b1d013cfaab6bcbdfdd259923e5a73’
doc = {‘branch’: ‘Graphic Designing’, ‘course’: ‘BA Graphic Communication’, ‘docstatus’: 0, ‘doctype’: ‘Courses’, ‘duration’: ‘36 Months’, ‘exam_accepted’: None, ‘fee’: ‘₹21.50 L/yr’, ‘level’: ‘UG’, ‘mode’: ‘Full time’, ‘modified’: ‘2024-06-20 16:52:46.424876’, ‘name’: ‘COR-33334’, ‘university’: ‘University of Reading, Reading’, ‘__islocal’: 1}
db_modified_timestamp = datetime.datetime(2024, 6, 20, 16, 52, 46, 424876)
is_db_timestamp_latest = True
new_modified_timestamp = ‘2024-06-20 16:52:46.243541’
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 231, in import_doc
delete_old_doc(doc, reset_permissions)
docdict = {‘branch’: ‘Graphic Designing’, ‘course’: ‘BA Graphic Communication’, ‘docstatus’: 0, ‘doctype’: ‘Courses’, ‘duration’: ‘36 Months’, ‘exam_accepted’: None, ‘fee’: ‘₹21.50 L/yr’, ‘level’: ‘UG’, ‘mode’: ‘Full time’, ‘modified’: ‘2024-06-20 16:52:46.424876’, ‘name’: ‘COR-33334’, ‘university’: ‘University of Reading, Reading’, ‘__islocal’: 1}
data_import = True
pre_process = None
ignore_version = None
reset_permissions = True
path = ‘/home/frappe/frappe-bench/apps/rawscholar/rawscholar/fixtures/courses.json’
controller = <class ‘rawscholar.rawscholar.doctype.courses.courses.Courses’>
doc = <Courses: COR-33334>
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 274, in delete_old_doc
frappe.delete_doc(doc.doctype, doc.name, force=1, ignore_doctypes=ignore, for_reload=True)
doc = <Courses: COR-33334>
reset_permissions = True
ignore =
old_doc = <Courses: COR-33334>
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1392, in delete_doc
return frappe.model.delete_doc.delete_doc(
doctype = ‘Courses’
name = ‘COR-33334’
force = 1
ignore_doctypes =
for_reload = True
ignore_permissions = False
flags = None
ignore_on_trash = False
ignore_missing = True
delete_permanently = False
…skipped… 1 vars
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 154, in delete_doc
delete_for_document(doc)
doctype = ‘Courses’
name = ‘COR-33334’
force = 1
ignore_doctypes =
for_reload = True
ignore_permissions = False
flags = None
ignore_on_trash = False
ignore_missing = True
delete_permanently = False
is_virtual = 0
names = [‘COR-33334’]
doc = <Courses: COR-33334>
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/global_search.py”, line 462, in delete_for_document
frappe.db.delete(“__global_search”, {“doctype”: doc.doctype, “name”: doc.name})
doc = <Courses: COR-33334>
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 1273, in delete
return query.run(**kwargs)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fdf4dd7b190>
doctype = ‘__global_search’
filters = {‘doctype’: ‘Courses’, ‘name’: ‘COR-33334’}
debug = False
kwargs = {‘debug’: False}
query = DELETE FROM __global_search WHERE doctype=‘Courses’ AND name=‘COR-33334’
File “/home/frappe/frappe-bench/apps/frappe/frappe/query_builder/utils.py”, line 87, in execute_query
result = frappe.db.sql(query, params, *args, **kwargs) # nosemgrep
query = ‘DELETE FROM __global_search WHERE doctype=%(param1)s AND name=%(param2)s’
args = ()
kwargs = {‘debug’: False}
child_queries =
params = {‘param1’: ‘Courses’, ‘param2’: ‘COR-33334’}
execute_child_queries = <function patch_query_execute..execute_child_queries at 0x7fdf4de2a020>
prepare_query = <function patch_query_execute..prepare_query at 0x7fdf4de2a0c0>
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 214, in sql
self.check_transaction_status(query)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fdf4dd7b190>
query = ‘DELETE FROM __global_search WHERE doctype=%(param1)s AND name=%(param2)s’
values = {‘param1’: ‘Courses’, ‘param2’: ‘COR-33334’}
as_dict = 0
as_list = 0
debug = False
ignore_ddl = 0
auto_commit = 0
update = None
explain = False
run = True
pluck = False
as_iterator = False
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 436, in check_transaction_status
raise frappe.TooManyWritesError(msg)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fdf4dd7b190>
query = ‘DELETE FROM __global_search WHERE doctype=%(param1)s AND name=%(param2)s’
msg = ‘

Too many changes to database in single action.
The changes have been reverted.

frappe.exceptions.TooManyWritesError:

Too many changes to database in single action.
The changes have been reverted.

someone please help me with this error