表现:界面上报错:,刚登陆进去就能看到,点击执行也会出现。日志里报:

Traceback (most recent call last):
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/decorators.py", line 81, in decorator
return func(*args, **kwargs)
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 124, in execute
history = _historify(notebook, request.user)
File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 319, in _historify
is_history=True
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 157, in create
return self.get_queryset().create(**kwargs)
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 322, in create
obj.save(force_insert=True, using=self.db)
File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 1138, in save
home_dir = Document2.objects.get_home_directory(self.owner)
File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 935, in get_home_directory
return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type='directory')
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 313, in get
(self.model._meta.object_name, num))
MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!

复现步骤:已账号xxxx登录hue,即可看到异常.

ps: 有人在官网报此问题,http://gethue.com/how-to-fix-the-multipleobjectsreturned-error-in-hue/  但官方没有给出解决方法.

根据stacktrace: File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 935, in get_home_directory查到代码:
  def get_home_directory(self, user):
try:
return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type='directory')
except Document2.DoesNotExist:
return self.create_user_directories(user)

是class Document2Manager的方法,怀疑是用户表中存的用户记录多了一条,所以查到两个home directory,查了auth_user表和useradmin_userprofile表,都正常。后又查表desktop_document2,按self.get()中的查询条件果然查到两行:

查别的正常账号,只有一条,解决方法应该是删掉多余的数据即可。
由于此表有个自连接的外键:CONSTRAINT `parent_directory_id_refs_id_4fe2babf` FOREIGN KEY (`parent_directory_id`) REFERENCES `desktop_document2` (`id`), 应先删除衍生数据,再删除根数据:
delete from desktop_document2 where parent_directory_id=7;
delete from desktop_document2 where id=7;
之后测试,果然解决。
为何会产生两条数据,原因未知。

解决HUE报错MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!的更多相关文章

  1. 解决hue报错:timed out (code THRIFTSOCKET): None

    报错栈: [/Jun/ :: +] decorators ERROR error running <function execute at 0x7fba2804ecf8> Tracebac ...

  2. Idea使用记录--添加Problems&&解决Autowired报错could not autowire

    今天在使用Idea的时候,发现Idea在整个每次找到错误代码非常不方便(Idea如果类中有错误,没有打开过类并不会提示,比如构建工程后缺少jar包问题).我想快速看到工程哪里出问题类似于eclipse ...

  3. [转]解决Maven报错"Plugin execution not covered by lifecycle configuration"

    [转]解决Maven报错"Plugin execution not covered by lifecycle configuration" 导入Myabtis源码后,POM文件会报 ...

  4. 解决MySQL报错ERROR 2002 (HY000)【转】

    今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...

  5. vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题

    vue解决启动报错cjs loader.js Error: Cannot find module '../config'问题 今天下载了一个开源项目一直运行不了,折腾了半天才找到问题所在,config ...

  6. 解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办

    解决 php 报错 open_basedir restriction in effect或者nginx提示No input file specified怎么办 问题是出现在了PHP.INI上面了 ,原 ...

  7. 解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat

    解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat ...

  8. eclips中maven解决jsp报错的问题

    加入如下的pom依赖: <!-- 解决jsp报错的依赖包第一个 --> <dependency> <groupId>javax.servlet</groupI ...

  9. 不修改系统日期和时间格式,解决Delphi报错提示 '****-**-**'is not a valid date and time

    假如操作系统的日期格式不是yyyy-MM-dd格式,而是用strtodate('2014-10-01')) 来转换的话,程序会提示爆粗 '****-**-**'is not a valid date ...

随机推荐

  1. EF – 4.CRUD与事务

    5.6.1 <Entity Framework数据更新概述>  首先介绍Entity Framework实现CRUD的基本方法,接着介绍了如何使用分部类增强和调整数据实体类的功能与行为特性 ...

  2. karma+seajs

    下面的介绍以karma能正常运行为前提,看karma系列文章:http://www.cnblogs.com/laixiangran/tag/Karma/ 目录结构 步骤 安装 npm install ...

  3. (转)一些牛人榜样,多看看他们写的东西(后续整理牛人的blog等)

    http://blog.csdn.net/ajian005/article/details/7697761

  4. checkbox 更改样式

    html: <div class="wrap"> <p>1. 勾选</p> <input type="checkbox" ...

  5. Ubuntu编译安装nginx,php,mysql

    摘要: 整理的Ubuntu编译安装nginx,php,mysql的步骤,主要来自对驻云的sh-1.4.1中脚本的整理,随时代进步,内容中的软件或者命令请自行更新 目录准备 创建用户 userdel w ...

  6. ie8浏览器 图片本身问题导致 无法显示图片--- 诡异现象的排查分享

    引子:   前段时间 做新版2.0 首页 的时候, 总感觉 新版首页 线上 精彩回顾下的 2张图片颜色怪怪的,当时以为是图片压缩太厉害导致的,由于实在太忙就没太在意!以下 是来自线上 截图:  红色方 ...

  7. VIM块操作

    一.可视模式 按v启用可视模式,之后移动光标可以选择. 如:     如果想整行操作,则用大写的V,再移动光标可以按行为单位进行选择. 二.列块操作 在 word中有一个功能,按alt加鼠标拖动,可以 ...

  8. 【Python初级】由判定回文数想到的,关于深浅复制,以及字符串反转的问题

    尝试用Python实现可以说是一个很经典的问题,判断回文数. 让我们再来看看回文数是怎么定义的: 回数是指从左向右读和从右向左读都是一样的数,例如1,121,909,666等 解决这个问题的思路,可以 ...

  9. code forces 505A

    Mr. Kitayuta's Gift Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64 ...

  10. loj2480 [CEOI2017]One-Way Streets 边双+树上差分

    边双无法确定 缩完边双就是一棵树 树上差分随意弄一下吧... #include <vector> #include <cstdio> #include <cstring& ...