Avoid global registration of psycopg2 adapters/extensions
|Reported by:||spoksss||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||carljm, apollo13||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
I have some problem while I use Django connection based on psycopg2 in the same time while using some other database application.
Because Django changes default psycopg2 settings (psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)),
I get "psycopg2.InterfaceError: can't decode into unicode string from SQLASCII", when I try use my external database application which works with SQLASCII after import django settings.
I think it isn't good way when Django changes default, global settings of psycopg2, because other application can have problems.
I have read documentation of psycopg2, and it is possible to set that psycopg2.extensions.UNICODE just for custom connection or cursor, so I think it is good idea to use that feature in Django.
I have tested my changes with psycopg 2.0.8 and Django-1.2-beta-1 and everything work correctly.
Change History (21)
comment:1 Changed 6 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 6 years ago by russellm
- Component changed from Uncategorized to Database layer (models, ORM)
- Has patch set
- Needs tests set
- Triage Stage changed from Unreviewed to Accepted