Created
June 17, 2011 16:00
-
-
Save cbess/1031701 to your computer and use it in GitHub Desktop.
django 1.3 postgresql schema (search path) fix for inspectdb and db connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= 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 |
personal ref: http://pastie.org/pastes/2069547
Had to add set search path to each execute call, for some reason it still couldn't find a few table relations. This is just for a database import script, so I'll sprinkle that line where ever its needed, for now.
Any idea about how to fix the search path in 1.8?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tested/used this in a production env (and it works)