#15131: pg_service.conf support -----------------------------------------------------+---------------------- Reporter: valczir.darkv...@gmail.com | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.2 Keywords: postgresql, pg_service, pg_service.conf | Stage: Unreviewed Has_patch: 1 | -----------------------------------------------------+---------------------- In PostgreSQL, there is a config file, pg_service.conf, that allows one to define shortcut names to connection parameters. This makes it easy to migrate a database without having to mess with individual application configurations - just change the pg_service.conf file and you're done.
I've managed to get it working, although I'm not sure this is the right way to do it. Unfortunately, as far as I know, psycopg2 only supports a service name in a dsn string, not as a connection param, so I've had to run a completely separate connect() for pg_service. However, as a service name in pg_service.conf defines all of the other connection options, I don't think it's a large problem; it just bothers me that they need to be separate. I'm also not sure how best to handle the case where there is a service name and also normal db connection params. On my side, since we're using pg_service for nearly everything, I've just got it ignoring normal connection params if a service name exists. Anyway, a diff between my a/base.py and b/base.py (a being the original django/db/backends/postgresql_psycopg2 directory, b being the copy of a where I was doing my changes) is attached, more to show what I did than as a suggested patch - this was just a quick hack thrown together to get things working for me. The version of django I was editing was 1.2.4, I believe (python26 manage.py --version shows 1.2.4, at least). I've tested both with a service and with the original connection params, and it seems to work. -- Ticket URL: <http://code.djangoproject.com/ticket/15131> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.