scholrly / neo4django

Drop-in Neo4j/Django integration.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to sync db with current HEAD

StevenMohr opened this issue · comments

I'm unable to run manage.py syncdb with the current HEAD. I have to use an older version like commit b847646, run syncdb and after that I can upgrade to HEAD. When using HEAD, I get an AtrributeError with Relationship has no 'to' Attribute. I'm using Neo4J 1.8.M07.

@StevenMohr Thanks for letting me know! I'm in the process of upgrading the library to fully support 1.7 & 1.8, and didn't notice this because we don't have a syncdb test case. In fact, if you have a chance to put together a test case it'd be a great contribution. I assume you're using the regular ORM in conjunction with neo4django?

Yes, I'm using it with the regular ORM. Do you have any tests that I can use to start for test case. I'm new to Django but have experience with Python and unit testing in general.

We use nose to run our tests (nosetests --with-regression neo4django/tests/). Nose lets you use just about any unit testing framework you're familiar with, though if you look through the 'tests' folder you'll see I typically stick with a test module that contains related single-function tests and assertions from nose.tools.

This will be the first Django command tested against the library- so it might make sense to put it in "django_tests.py" and either call syncdc programmatically or using some sort of subprocess.

I'd love to have you as a contributor, but let me know if it's too much work and I'll figure something out :)

Oh, and the README has a bit more detailed info on the subject.

I'll write a test today or tomorrow. Hopefully, I will find a way to reproduce it (it seems to need an empty database to occur)

Any luck replicating this?

I had a busy weekend :-) Hopefully, I can write the test tomorrow. Maybe I even don't need a new test but I just have to add a relationship to the model used in the tests. I think the problem is not the syncdb command but the empty database.

I tried to reproduce the error today but without any results (Maybe that's a good thing .. :-)) But I have to migrate my project to our production server in a few weeks and maybe the bug will occur again...

Re-open if you see it again! I hate phantom bugs too.

Okay, I just got the exception again and for now I got a copy of the traceback:
Unhandled exception in thread started by <bound method Command.inner_run of <django.
contrib.staticfiles.management.commands.runserver.Command object at 0x95be86c>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/mana
gement/commands/runserver.py", line 91, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/mana
gement/base.py", line 266, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/mana
gement/validation.py", line 145, in get_validation_errors
for r in rel_opts.get_all_related_objects():
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models
/options.py", line 366, in get_all_related_objects
include_proxy_eq=include_proxy_eq)]
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models
/options.py", line 378, in get_all_related_objects_with_model
self._fill_related_objects_cache()
File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/db/models
/options.py", line 403, in _fill_related_objects_cache
if f.rel and not isinstance(f.rel.to, basestring):
AttributeError: 'Relationship' object has no attribute 'to'

Awesome, thanks. I think I can do something with this..