Column 'translatable' cannot be null

@tundebabzy

for develop or for master please?

develop since you are still on develop branch

I meant in your bench IPython console
run bench --site [your-site-name] console

Sry:

It is

I am also having this issue. Both develop and master branches exhibit this behavior, even after bench update --reset and bench update --patch. It is a blocking error for me.
I ran the patch code and it also returned true. I have lost three days to this “improvement” now.

To all people having this issue, the solution pointed by @tundebabzy here Error on bench update pymysql.err.IntegrityError: (1048, u"Column 'translatable' cannot be null") · Issue #13011 · frappe/erpnext · GitHub worked for me, I had to allow null values on translatable column on tabDocField.

1 Like

@applepipe Could you kindly provide instructions on this? I assume you did this via the MariaDB console?

@tmatteson
You can check before “translatable” existing :
bench mysql
SHOW COLUMNS FROM tabDocField
Exit sql CTRL+C

Then you can delete it:

bench mysql
ALTER TABLE tabDocField DROP COLUMN translatable;
Exit sql CTRL+C

Run bench update again

Hope this helps.

3 Likes

Thanks @krnkris.
I am now experiencing the “cannot be null” error in a custom app. What is the root issue and how can I fix it myself?

Edit:
I’m not sure what caused this between the delete/ recreate, uninstall/reinstall app, but I ended up editing the DB directly using your code above.

I also searched for it with this bit of SQL:

select * from INFORMATION_SCHEMA.COLUMNS 
where COLUMN_NAME like '%problem_column%' 
order by TABLE_NAME
1 Like

you are the best

Best is who not blame - other + self - just find the solution, because it is allways there.

Glad to let open the path to find it. J

Sorry for the long time to answer, but I used dbeaver to uncheck the option to not allow null values, I dont know how to do it via terminal yet.

Once you have dbeaver installed and configured to connect to your database, just open the desired table and uncheck the option like the screenshot below

1 Like
alter table tabDocField modify column translatable int(1) NULL default 0;

can be used for changing via terminal.

But next I ran into -

pymysql.err.IntegrityError: (1048, u"Column 'allow_in_quick_entry' cannot be null")

Again solved with

 alter table tabDocField modify column allow_in_quick_entry int(1) NULL default 0;

Am on master branch frappe + erpnext.

Changes happening in the frappe framework seem to be interfering with

bench update --patch

Now with the above two modifications, the update went through. Sigh!!

6 Likes

Thanks work like a charm.

@NMyshuk Natalia, can you mark one of these as a solution? I like @intelliant01’s answer, personally.

ohh, sorry in my case it was fixed with updating:) and yes, i made @intelliant01 answer as solution

1 Like

Updating DocTypes for frappe : [ ] Traceback (most recent call last):
File “/usr/lib64/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib64/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpnext/bench-core/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/erpnext/bench-core/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/click/decorator s.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpnext/bench-core/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpnext/bench-core/apps/frappe/frappe/commands/site.py”, line 222, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erpnext/bench-core/apps/frappe/frappe/migrate.py”, line 41, in mig rate
frappe.model.sync.sync_all(verbose=verbose)
File “/home/erpnext/bench-core/apps/frappe/frappe/model/sync.py”, line 19, in sync_all
sync_for(app, force, verbose=verbose, reset_permissions=reset_permissions)
File “/home/erpnext/bench-core/apps/frappe/frappe/model/sync.py”, line 56, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File “/home/erpnext/bench-core/apps/frappe/frappe/modules/import_file.py”, lin e 58, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/erpnext/bench-core/apps/frappe/frappe/modules/import_file.py”, lin e 132, in import_doc
doc.insert()
File “/home/erpnext/bench-core/apps/frappe/frappe/model/document.py”, line 241 , in insert
d.db_insert()
File “/home/erpnext/bench-core/apps/frappe/frappe/model/base_document.py”, lin e 303, in db_insert
), list(d.values()))
File “/home/erpnext/bench-core/apps/frappe/frappe/database.py”, line 199, in s ql
self._cursor.execute(query, values)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/cursors .py”, line 170, in execute
result = self._query(query)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/cursors .py”, line 328, in _query
conn.query(q)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/connect ions.py”, line 516, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/connect ions.py”, line 727, in _read_query_result
result.read()
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/connect ions.py”, line 1066, in read
first_packet = self.connection._read_packet()
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/connect ions.py”, line 683, in _read_packet
packet.check_error()
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/protoco l.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/erpnext/bench-core/env/lib/python2.7/site-packages/pymysql/err.py” , line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.IntegrityError: (1048, u"Column ‘apply_user_permissions’ cannot be null")

How do I know which table that have column “apply_user_permissions”?

Tyler’s post # 15 above suggests this query expression

MariaDB [d56cb677eaab3383]> select * from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME like '%apply_user_permissions%' order by TABLE_NAME;
+---------------+------------------+-------------------+------------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+---------------------------------+----------------+--------------+-----------------------+
| TABLE_CATALOG | TABLE_SCHEMA     | TABLE_NAME        | COLUMN_NAME            | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | DATETIME_PRECISION | CHARACTER_SET_NAME | COLLATION_NAME | COLUMN_TYPE | COLUMN_KEY | EXTRA | PRIVILEGES                      | COLUMN_COMMENT | IS_GENERATED | GENERATION_EXPRESSION |
+---------------+------------------+-------------------+------------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+---------------------------------+----------------+--------------+-----------------------+
| def           | d56cb677eaab3383 | tabCustom DocPerm | apply_user_permissions |               29 | 0              | NO          | int       |                     NULL |                   NULL |                10 |             0 |               NULL | NULL               | NULL           | int(1)      |            |       | select,insert,update,references |                | NEVER        | NULL                  |
| def           | d56cb677eaab3383 | tabDocPerm        | apply_user_permissions |               28 | 0              | NO          | int       |                     NULL |                   NULL |                10 |             0 |               NULL | NULL               | NULL           | int(1)      |            |       | select,insert,update,references |                | NEVER        | NULL                  |
| def           | d56cb677eaab3383 | tabReport         | apply_user_permissions |               11 | 1              | NO          | int       |                     NULL |                   NULL |                10 |             0 |               NULL | NULL               | NULL           | int(1)      |            |       | select,insert,update,references |                | NEVER        | NULL                  |
+---------------+------------------+-------------------+------------------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+--------------------+----------------+-------------+------------+-------+---------------------------------+----------------+--------------+-----------------------+

3 rows in set (0.09 sec)

Thank you, found it

1 Like

Hi @intelliant01 I have this issue
after running first command I got allow_in_quick_entry error again I run second command now when I update I get this error

bench@mmerpdemo06:~/erpnext$ bench update --patch
Backing up sites...
Patching sites...
Migrating site1.local
Executing execute:frappe.reload_doc('core', 'doctype', 'docperm') #2017-03-03 in site1.                                                                                          local (_1bd3e0294da19198)
Success
Executing execute:frappe.delete_doc("DocType", "Hub Settings", ignore_missing=True) in                                                                                           site1.local (_1bd3e0294da19198)
Success
Executing erpnext.patches.v4_0.set_naming_series_property_setter in site1.local (_1bd3e                                                                                          0294da19198)
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 "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 94, in <modu                                                                                          le>
    main()
  File "/opt/bench/erpnext/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 7                                                                                          64, in __call__
    return self.main(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 7                                                                                          17, in main
    rv = self.invoke(ctx)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1                                                                                          137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 1                                                                                          137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 9                                                                                          56, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/core.py", line 5                                                                                          55, in invoke
    return callback(*args, **kwargs)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/click/decorators.py",                                                                                           line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/commands/site.py", line 222, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/opt/bench/erpnext/apps/frappe/frappe/migrate.py", line 31, in migrate
    frappe.modules.patch_handler.run_all()
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 29, in ru                                                                                          n_all
    if not run_single(patchmodule = patch):
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 63, in ru                                                                                          n_single
    return execute_patch(patchmodule, method, methodargs)
  File "/opt/bench/erpnext/apps/frappe/frappe/modules/patch_handler.py", line 83, in ex                                                                                          ecute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/opt/bench/erpnext/apps/erpnext/erpnext/patches/v4_0/set_naming_series_property                                                                                          _setter.py", line 36, in execute
    series_to_set = get_series_to_set()
  File "/opt/bench/erpnext/apps/erpnext/erpnext/patches/v4_0/set_naming_series_property                                                                                          _setter.py", line 49, in get_series_to_set
    if not frappe.db.a_row_exists(doctype):
  File "/opt/bench/erpnext/apps/frappe/frappe/database.py", line 788, in a_row_exists
    return self.sql("select name from `tab{doctype}` limit 1".format(doctype=doctype))
  File "/opt/bench/erpnext/apps/frappe/frappe/database.py", line 176, in sql
    self._cursor.execute(query)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/cursors.py", l                                                                                          ine 170, in execute
    result = self._query(query)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/cursors.py", l                                                                                          ine 328, in _query
    conn.query(q)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py                                                                                          ", line 516, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py                                                                                          ", line 727, in _read_query_result
    result.read()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py                                                                                          ", line 1066, in read
    first_packet = self.connection._read_packet()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/connections.py                                                                                          ", line 683, in _read_packet
    packet.check_error()
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/protocol.py",                                                                                           line 220, in check_error
    err.raise_mysql_exception(self._data)
  File "/opt/bench/erpnext/env/local/lib/python2.7/site-packages/pymysql/err.py", line                                                                                           109, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, u"Table '_1bd3e0294da19198.tabProduction Order' do                                                                                          esn't exist")