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

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. go接口及嵌入类型例子

    书上看的.慢慢领会.. package main import ( "fmt" ) type notifier interface { notify() } type user s ...

  2. IE8/9的几个前端bug解决方案

    最近做的东西需要兼容IE……啊真是令人忧伤…… 解决低版本IE的buggy inline-block 低版本的IE只对本身inline的元素能用inline-block,而本身为block的元素需要设 ...

  3. 【PAT】1011. A+B和C (15)

    1011. A+B和C (15) 给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测 ...

  4. Selenium--testNG下载地址

    TestNG - http://beust.com/eclipse   http://testng.org/doc/eclipse.html http://testng.org/doc/seleniu ...

  5. MySQL几个特别语法示例

    简单介绍MySQL中几种特殊语法的用法: 1.创建示例用表和数据: 创建employees表[注:与SQL Server示例数据库Northwind中的表employees相同的表结构]: CREAT ...

  6. shell 从变量中切割字符串

    1. 在shell变量中切割字符串 shell中截取字符串的方法有很多中,${expression}一共有9种使用方法.${parameter:-word}${parameter:=word}${pa ...

  7. 借助jxl将Excel中的数据注入到Bean中

    前言 使用了Hibernate的项目中需要导入多张表的数据,但是我又不想写多次取出Excle数据放到Bean里的代码,于是写了个ExcleUtils来帮助我做这件事. 基本思路 技术上,首先肯定是要借 ...

  8. xpath相关巩固

    python爬虫xpath的语法 XPath 是一门在 XML 文档中查找信息的语言.XPath 可用来在 XML 文档中对元素和属性进行遍历. XPath 是 W3C XSLT 标准的主要元素,并且 ...

  9. mac系统终端下忽略大小写 与 git自动补全(git auto completion)

    1.下载git-completion.bash 并放到home 目录下: curl https://raw.githubusercontent.com/git/git/master/contrib/c ...

  10. android 启动流程

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha adb shell 后  用 ps 命令 回车 可以看到 运行的进程. 如下结果: ct ...