Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryError #55

Closed
unformatt opened this issue Apr 18, 2016 · 2 comments
Closed

MemoryError #55

unformatt opened this issue Apr 18, 2016 · 2 comments

Comments

@unformatt
Copy link

I've added one record to the database and tried to load it and got a memory error. Any idears?

>>> from models import MyModel
>>> MyModel.objects.get(id=1)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "lib/python2.7/site-packages/django/db/models/manager.py", line 122, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "lib/python2.7/site-packages/django/db/models/query.py", line 381, in get
    num = len(clone)
  File "lib/python2.7/site-packages/django/db/models/query.py", line 240, in __len__
    self._fetch_all()
  File "lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
    self._result_cache = list(self.iterator())
  File "lib/python2.7/site-packages/django/db/models/query.py", line 52, in __iter__
    results = compiler.execute_sql()
  File "lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 879, in execute_sql
    return list(result)
  File "lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1239, in cursor_iter
    sentinel):
  File "lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1238, in <lambda>
    for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
  File "lib/python2.7/site-packages/django/db/utils.py", line 102, in inner
    return func(*args, **kwargs)
  File "lib/python2.7/site-packages/sql_server/pyodbc/base.py", line 581, in fetchmany
    return self.format_rows(self.cursor.fetchmany(chunk))
MemoryError
@unformatt
Copy link
Author

Running the query directly in pyodbc (foregoing django abstraction), I've tracked the problem down to a field defined as [MyField] [numeric](10, 0) NULL. The value in the DB is NULL and this is causing the problem.

@unformatt
Copy link
Author

Same error reported here: mkleehammer/pyodbc#35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant