Django的MemoryError [英] MemoryError with django

查看:30
本文介绍了Django的MemoryError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个django应用程序,可将大量数据加载到sqlite3数据库文件中.
我们正在谈论数以百万计的条目,它们是在某个函数的执行点抛出的一个函数中输入的:

I have a django app that loads a lot of data into a sqlite3 database file.
We are talking about millions of entries, entered in one function that at some point of its execution is throwing:

  File "/root/codebase/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/transaction.py", line 219, in inner
    self.__exit__(*sys.exc_info())
  File "/root/codebase/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/transaction.py", line 207, in __exit__
    self.exiting(exc_value, self.using)
  File "/root/codebase/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/transaction.py", line 286, in exiting
    leave_transaction_management(using=using)
  File "/root/codebase/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/transaction.py", line 56, in leave_transaction_management
    connection.leave_transaction_management()
  File "/root/codebase/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg/django/db/backends/__init__.py", line 114, in leave_transaction_management
    self.rollback()
MemoryError

我检查了我的功能,它没有泄漏内存.这里还有什么可以做的?

I examined my function and it is NOT leaking memory. What else can be done here?

推荐答案

该函数可能不是,但是如果您使用如此庞大的数据库,sqlite库可能会使用它来更新表.如果您需要存储如此大量的数据,则可能必须从SQLite转移到功能全面的数据库服务器(如MySQL).

The function may not be, but if your realing with such a huge database, the sqlite library may be consuming it in order to update the table. If you need to store such huge amounts of data you may have to move away from SQLite to a fully featured database server such as MySQL.

这篇关于Django的MemoryError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆