Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Version-3 install errors: fixtures imported before doctype exists #667

@casesolved-co-uk

Description

@casesolved-co-uk

Three fixtures exist in the fixtures dir that cannot be imported until the doctype has been installed and exists in the DB. Unfortunately the standard frappe install procedure is the other way around.

Suggestion

  • Move the fixtures to another directory so they are not auto-installed
  • Write an after_install script that loads them in once only

Several errors in a row interrupt first install on a site:

Error in query:\n('SELECT name FROM tabInsights Team WHERE name=%(param1)s LIMIT 1', {'param1': 'Admin'})

"Error in query:\n('SELECT modified FROM tabInsights Data Source v3 WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1', {'param1': 'Site DB'})"
Skipping fixture syncing from the file insights_data_source_v3.json. Reason: Module import failed for Insights Data Source v3, the DocType you're trying to open might be deleted.

"Error in query:\n('SELECT modified FROM tabInsights Data Source WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1', {'param1': 'Site DB'})"
Skipping fixture syncing from the file insights_data_source.json. Reason: Module import failed for Insights Data Source, the DocType you're trying to open might be deleted.

"Error in query:\n('SELECT modified FROM tabInsights Notebook WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1', {'param1': 'Uncategorized'})"
Skipping fixture syncing from the file insights_notebook.json. Reason: Module import failed for Insights Notebook, the DocType you're trying to open might be deleted.
Error: No module named 'frappe.core.doctype.insights_notebook'

$ bench --site <site> install-app insights

Installing insights...
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/site.py", line 452, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "/home/rich/v14-staging/apps/frappe/frappe/installer.py", line 322, in install_app
    frappe.get_attr(after_install)()
  File "/home/rich/v14-staging/apps/insights/insights/migrate.py", line 10, in after_migrate
    create_admin_team()
  File "/home/rich/v14-staging/apps/insights/insights/migrate.py", line 16, in create_admin_team
    if not frappe.db.exists("Insights Team", "Admin"):
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 1123, in exists
    return self.get_value(dt, dn, ignore=True, cache=cache, order_by=None)
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/rich/v14-staging/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 255, in sql
    traceback.print_stack()
"Error in query:\n('SELECT `name` FROM `tabInsights Team` WHERE `name`=%(param1)s LIMIT 1', {'param1': 'Admin'})"
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/site.py", line 452, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "/home/rich/v14-staging/apps/frappe/frappe/installer.py", line 328, in install_app
    sync_fixtures(name)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 22, in sync_fixtures
    import_fixtures(app)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 41, in import_fixtures
    import_doc(file_path)
  File "/home/rich/v14-staging/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 265, in import_do
c
    import_file_by_path(
  File "/home/rich/v14-staging/apps/frappe/frappe/modules/import_file.py", line 125, in import_file_by_path
    db_modified_timestamp = frappe.db.get_value(doc["doctype"], doc["name"], "modified")
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/rich/v14-staging/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 255, in sql
    traceback.print_stack()
"Error in query:\n('SELECT `modified` FROM `tabInsights Data Source v3` WHERE `name`=%(param1)s ORDER BY `modified
` DESC LIMIT 1', {'param1': 'Site DB'})"
Skipping fixture syncing from the file insights_data_source_v3.json. Reason: Module import failed for Insights Dat
a Source v3, the DocType you're trying to open might be deleted.
Error: No module named 'frappe.core.doctype.insights_data_source_v3'
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/site.py", line 452, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "/home/rich/v14-staging/apps/frappe/frappe/installer.py", line 328, in install_app
    sync_fixtures(name)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 22, in sync_fixtures
    import_fixtures(app)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 41, in import_fixtures
    import_doc(file_path)
  File "/home/rich/v14-staging/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 265, in import_do
c
    import_file_by_path(
  File "/home/rich/v14-staging/apps/frappe/frappe/modules/import_file.py", line 125, in import_file_by_path
    db_modified_timestamp = frappe.db.get_value(doc["doctype"], doc["name"], "modified")
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/rich/v14-staging/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 255, in sql
    traceback.print_stack()
"Error in query:\n('SELECT `modified` FROM `tabInsights Data Source` WHERE `name`=%(param1)s ORDER BY `modified` D
ESC LIMIT 1', {'param1': 'Site DB'})"
Skipping fixture syncing from the file insights_data_source.json. Reason: Module import failed for Insights Data S
ource, the DocType you're trying to open might be deleted.
Error: No module named 'frappe.core.doctype.insights_data_source'
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/home/rich/v14-staging/env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/rich/v14-staging/apps/frappe/frappe/commands/site.py", line 452, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "/home/rich/v14-staging/apps/frappe/frappe/installer.py", line 328, in install_app
    sync_fixtures(name)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 22, in sync_fixtures
    import_fixtures(app)
  File "/home/rich/v14-staging/apps/frappe/frappe/utils/fixtures.py", line 41, in import_fixtures
    import_doc(file_path)
  File "/home/rich/v14-staging/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 265, in import_do
c
    import_file_by_path(
  File "/home/rich/v14-staging/apps/frappe/frappe/modules/import_file.py", line 125, in import_file_by_path
    db_modified_timestamp = frappe.db.get_value(doc["doctype"], doc["name"], "modified")
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 512, in get_value
    result = self.get_values(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 616, in get_values
    out = self._get_values_from_table(
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 889, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/rich/v14-staging/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/rich/v14-staging/apps/frappe/frappe/database/database.py", line 255, in sql
    traceback.print_stack()
"Error in query:\n('SELECT `modified` FROM `tabInsights Notebook` WHERE `name`=%(param1)s ORDER BY `modified` DESC
 LIMIT 1', {'param1': 'Uncategorized'})"
Skipping fixture syncing from the file insights_notebook.json. Reason: Module import failed for Insights Notebook,
 the DocType you're trying to open might be deleted.
Error: No module named 'frappe.core.doctype.insights_notebook'
Updating Dashboard for insights

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions