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

Django 1.9 and relation "django_facebook_open_graph_share" does not exist #570

Open
turukawa opened this issue Apr 9, 2016 · 4 comments

Comments

@turukawa
Copy link

turukawa commented Apr 9, 2016

I've been upgrading a Django project to 1.9 and get the following error with Django Facebook:

ProgrammingError at /admin/django_facebook/opengraphshare/
relation "django_facebook_open_graph_share" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "django_facebook_open_grap...

I've installed the Django Facebook 6.0.4 version from Master which is mostly Django 1.9 compliant (and I fixed the urlpatterns in urls.py for my version).

On my build the error is simple enough to reproduce. Go into the admin view and select Open graph shares. Instant chaos.

I've seen the discussion for #523 by @amarpreetsaini but there doesn't seem to be any resolution to that, and I'm not sure if this is new and related to 1.9.

I'm less interested in the OpenGraphShare problem than that this prevents me deleting users (results in the same error message).

Any ideas?

@turukawa
Copy link
Author

turukawa commented Apr 9, 2016

UPDATE: this seems a very terrible and stupid hack, but - after the database has been created - if I directly edit the table name from 'django_facebook_opengraphshare' to 'django_facebook_open_graph_share' it works.

I don't feel comfortable doing this, so would prefer a more lasting solution. Any thoughts?

@jrabbit
Copy link
Contributor

jrabbit commented Jun 15, 2016

So this appears to be because of

db_table = facebook_settings.FACEBOOK_OG_SHARE_DB_TABLE
which #django says is bad.

@tschellenbach: What's the benefit of having the complex table renaming like in

class BaseModelMetaclass(ModelBase):
? Doesn't django do it for you?

@jsvaughan
Copy link

As a workaround note that:

  • You can tell django-facebook explicitly what this table is called with this setting:
    FACEBOOK_OG_SHARE_DB_TABLE= 'django_facebook_open_graph_share'

  • But you will still get this problem when, for example, running tests, because django attempts to serialize the database contents so it can do a pseudo rollback even if you aren't using transactions (I know - this was news to me too). Given that you are bound to be using transactions, you can set the SERIALIZE django parameter to False (see https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-TEST_SERIALIZE) and this will stop it trying to query the table contents prior to running the tests. e.g.

    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.mysql',
    ...
    'TEST': {
    'SERIALIZE': False,
    }
    },

I'm part way through a django upgrade so YMMV but I am at least able now to run my test suite

@Jiloc
Copy link

Jiloc commented Apr 23, 2018

still no fixes? I am running in to this right now

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

4 participants