Your Ad Here

Tuesday, January 3, 2012

Re: Get database server version

On 03.01.2012 11:22, Thomas Guettler wrote:
> Hi,
>
> while testing my application with 1.4 alpha, I see that connection._version no longer exists.
>
> How can I get the database server's version? Up to now I only use postgres, but a portable way would
> be better.
>
> Thomas
>
>

May postgres only solution looks like this. It sets _version to a tuple like in django 1.3

version=getattr(connection, '_version', None)
if version is None:
# Django 1.4 and newer
version=connection.pg_version
version=[int(i) for i in re.match(r'^(\d\d?)(\d\d)(\d\d)$', str(version)).groups()]
connection._version=version

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail
: guettli (*) thomas-guettler + de

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 comments:

Post a Comment