Задать вопрос

Тел: +7 965 3737 888

474

Просмотров

0

Ответов

Multi-DB Reconnecting Persistent Postgres Connection

This is a modification of http://djangosnippets.org/snippets/1707/ that handles the database going down or PG Bouncer killing the connection. This also works in things like Twisted to make sure the connection is alive before doing a real query. Thanks @mike_tk for the original post!

EDIT: Updated the wrapper to handle multi-db. Before it was using the first connection it made, now it creates an attribute name for the connection based on the name of the database.

Вопрос полезен? Да0/Нет0
file_5153.py(1.9Кб)
None