-
Notifications
You must be signed in to change notification settings - Fork 142
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
register_hstore_handler is not run during django management commands #141
Comments
I am too facing the same issue. Can you elaborate a bit on how you are solving the issue for now .i.e (where do you get the connection object to pass in the register_hstore function) |
I ran into this problem too - in both @sanchitsharma: I worked around it by adding this to my management command: from django.db import connection
from psycopg2.extras import register_hstore
# And then in `def handle`
register_hstore(connection.cursor(), globally=True, unicode=True) |
is |
I'm suddenly seeing this after upgrading from Django 1.7 to Django 1.8.17 (and from django-hstore 1.4 to 1.4.2, though not surprisingly reverting that minor upgrade doesn't change anything).
I don't have a small reproducible case, but I'm happy to debug. The workaround described by @clifff works for me, but would of course be pretty ugly to add to every management command. |
I just started using django_hstore with a project and am encountering this same issue, and the workaround worked for me. Just curious if anyone had any more information on this before I started digging into it? Django 1.8.18, django_hstore 1.4.2. |
@DustinHolden which workaround worked for you? I have one that works in shell/shell_plus, but I haven't figured out how to incorporate it into migration generation, which is a constant pain. |
Hi All,
I'm experiencing the same problem as issue #93, I'm not a postgis user though, and neither of the two suggested settings workarounds seem to affect my issue, which occurs when running a Django management command that uses a couple of models that contain hstore fields. I'm using Django 1.8.6, django_hstore 1.4.1 and psycopg2 2.6.1.
I've confirmed that the hstore oids are consistent among the databases, and then did a little printf debugging. I found that register_hstore_handler is never called, but that I can fix the str-instead-of-dict problem by explicitly calling psycopg2.extras.register_hstore during the management command's constructor.
We don't use the transaction middleware, but do have a number of other middlewares enabled that I presume could affect signal delivery in the same way.
I'd like to provide more useful information in the issue request, but at the moment I'm not sure what to check next- any advice appreciated.
The text was updated successfully, but these errors were encountered: