A better PyGreSql support for Django

Published on 02 January 2014 in Development - 1 minute read - Last modified on 19 April 2021

With the release of django-pygresql, the Hue team has taken a first stab at PyGreSQL support in Django!

The ‘Why’

The open source world has many different kinds of licenses and it can be confusing to know which one makes sense for you. PyGreSQL is a PostgreSQL client with a permissible enough license that it can be packaged and shipped.

The ‘How’

PyGreSQL has some minor differences from the provided postgresql backend. It required a few changes including:

  • Massaging Date/Datetime/Time types to work with Django.
  • A custom cursor for massaging data.
  • Custom autocommit management.

 

To install this backend:

  1. Download django-pygresql.

  2. Run

    unzip master.zip && cd django-pygresql-master && /build/env/bin/python install setup.py

  3. At the bottom of /desktop/core/src/desktop/settings.py, add the following code:

if DATABASES['default']['ENGINE'] == 'django_pygresql':
  SOUTH_DATABASE_ADAPTERS = {
    'default': 'south.db.postgresql_psycopg2'
  }
  1. In the hue.ini, set desktop->database->engine to “django_pygresql”. Then, add the normal postgresql configuration parameters.

Summary

This is an initial implementation of a backend for Django to communicate with PostgreSQL via PyGreSQL. We hope this helps other members of the community.

 

Write to us athue-user mailing list or@gethue!


comments powered by Disqus

More recent stories

03 May 2023
Discover the power of Apache Ozone using the Hue File Browser
Read More
23 January 2023
Hue 4.11 and its new dialects and features are out!
Read More