Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save derblub/5ca008a8262f3839cf5c3b4dba5dbdc5 to your computer and use it in GitHub Desktop.
Save derblub/5ca008a8262f3839cf5c3b4dba5dbdc5 to your computer and use it in GitHub Desktop.
django 1.3 postgresql schema (search path) fix for inspectdb and db connection
= Modify: django.core.management.commands.inspectdb
- line 33, add
- cursor.execute("SET search_path TO myschema")
- line 80, change to
- field_type = 'ForeignKey(\'%s\'' % rel_to
- now you can ignore the model ordering
= Modify: django.db.backends.postgres_psycopg2.base
- line 147, add
- cursor.execute("SET search_path TO myschema")
- You may need to add the above line to lines 46 and 55, so that it happens during each execute
- C. Bess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment