I'm getting bit trying to dumpdata from a legacy db i've recently did a reverse engineering using django's inspectdb... Other than this every query works fine. In MySQL workbench the column exists. But when trying to export the data I get:

我正在尝试使用遗留数据库中的dumpdata我最近使用django的inspectdb进行了逆向工程...除此之外,每个查询都可以正常工作。在MySQL工作台中,该列存在。但是当我尝试导出数据时,我得到:

CommandError: Unable to serialize database: no such column: af_datper.locnac

Using traceback doesn't reveal any of my lines affecting (pasted here not to pollute http://dpaste.com/1DASN1V).

使用追溯并不会显示任何影响我的线条(此处粘贴不会污染http://dpaste.com/1DASN1V)。

The model field already admits null values for that column and the column does exists in the database (among seeing it with the workbench, inspectdb wouldn't have picked it up...

模型字段已经允许该列的空值,并且该列确实存在于数据库中(在使用工作台查看它时,inspectdb将不会将其拾取...

I honestly don't know what else to do. Any takers?

老实说,我不知道还能做什么。任何接受者?

1 个解决方案

#1


1

A bit of digging into your traceback, I see this:

有点挖掘你的追溯,我看到了这个:

File "venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "venv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 323, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: no such column: af_datper.locnac

文件“venv / lib / python3.5 / site-packages / django / db / backends / utils.py”,第64行,执行返回self.cursor.execute(sql,params)文件“venv / lib / python3.5 /site-packages/django/db/backends/sqlite3/base.py“,第323行,执行返回Database.Cursor.execute(self,query,params)sqlite3.OperationalError:没有这样的列:af_datper.locnac

From the SQLite documentation:

从SQLite文档:

If a schema-name is specified, it must be either "main", "temp", or the name of an attached database. In this case the new table is created in the named database. If the "TEMP" or "TEMPORARY" keyword occurs between the "CREATE" and "TABLE" then the new table is created in the temp database. It is an error to specify both a schema-name and the TEMP or TEMPORARY keyword, unless the schema-name is "temp". If no schema name is specified and the TEMP keyword is not present then the table is created in the main database.

如果指定了模式名称,则它必须是“main”,“temp”或附加数据库的名称。在这种情况下,新表是在指定的数据库中创建的。如果在“CREATE”和“TABLE”之间出现“TEMP”或“TEMPORARY”关键字,则在临时数据库中创建新表。除非schema-name是“temp”,否则指定schema-name和TEMP或TEMPORARY关键字是错误的。如果未指定模式名称且TEMP关键字不存在,则在主数据库中创建表。

In short, sqlite doesn't support foo.bar as a column name, unless foo is the name of the database or one of main or temp.

简而言之,sqlite不支持foo.bar作为列名,除非foo是数据库的名称或者是main或temp之一。

更多相关文章

  1. 如何知道php脚本中的名称是指mysql表还是mysql视图
  2. 如何使用mysql在php文件夹中快速更改图像名称?
  3. 具有相同名称的Mutiple按钮显示不同的div。
  4. 名称`posix`在何处/如何通过import语句解析?
  5. Python NameError:全局名称“Form”没有定义pyqt
  6. Python(名称空间、函数嵌套、函数对象)
  7. Python 3.4中的Pytesser:名称“image_to_string”没有定义?
  8. 获取网卡名称 linux c
  9. 如何利用SQL语句查询数据库中所有表的名称?

随机推荐

  1. 输入两个整数调用puts函数,求两个整数的乘
  2. Linux性能优化(九)——Kernel Bypass
  3. 输入一个数加上12的结果
  4. 太强了!这款轻量级的数据库中间件完美解决
  5. 更轻量级的 V8 引擎[每日前端夜话0xC8]
  6. JavaScript中的异步生成器函数[每日前端
  7. 编码与编程的区别是什么?[每日前端夜话0xC
  8. 太强了!这两款数据库中间件,完美解决 Sprin
  9. Spring Boot 项目中的三种多数据源方案,一
  10. 丢弃掉那些 BeanUtils 工具类吧,MapStruct