Skip to main content

NuoDB Extension for Django

Project description

# NuoDB - Django

[![Build Status](](

This is the official Django adapter for [NuoDB]( It leverages the [NuoDB Python Driver](

### Requirements

The Django version we currently support is Django 1.5.

If you haven't already, [Download and Install NuoDB](

In the file in your project, set the `USE_TZ` flag to False. This is done because the timezone is detected when the connection is created.

Set the `ENGINE` field in the `DATABASES/default` dictionary in to the django_pynuodb folder (if you installed using pip this is just `django_pynuodb`)

You can optionally set the schema by adding a `SCHEMA` field in the `DATABASES/default` dictionary in, if the schema is not specified it will default to `USER`

### Setup

git clone and install it

git clone
cd nuodb-django
python install

or install with pip

sudo pip install django_pynuodb

### Migrating from an existing Django app

To migrate data from an exiting Django app using a different database, the process is similar to migrating from another database to NuoDB using the [Migration Tool]( The difference here is that we will be skpping the schema command. Django requires a specific file structure to function correctly, so in order to ensure that our Django app has the same structure in NuoDB as it does with a different database we will use Django's syncdb command to set up our schema.

To illustrate the steps involved we will use an app deployed with postgresql as an example...


1) Using the NuoDB Migrator, dump the data from your postgresql Django app into a csv file.

$NUODB_HOME/bin/nuodb-migrator dump --source.driver=org.postgresql.Driver --source.url=jdbc:postgresql://localhost/test --source.username=postgres --output.type=csv --output.path=/tmp/

2) From your Django app configured to use NuoDB (for an example of this look in the Sample section below.) perform a syncdb.

python syncdb

3) We only performed this syncdb so that we could get the correct table structure for our database. The next step is to empty out the data that Django creates for us so that we have a clean database to import our data from postgresql. We do this using the TRUNCATE TABLE command in nuosql.

nuosql test --user dba --password goalie
SQL> show tables

Tables in schema USER

SQL> truncate table user.auth_group;
SQL> truncate table user.auth_group_permissions;
SQL> truncate table user.auth_permission;
SQL> truncate table user.auth_user;
SQL> truncate table user.auth_user_groups;
SQL> truncate table user.auth_user_user_permissions;
SQL> truncate table user.django_content_type;
SQL> truncate table user.django_session;
SQL> truncate table user.django_site;

4) For our last step we need to import the data from our postgresql database into our new NuoDB database. For this we are going to use the NuoDB Migrator tool's load command.

$NUODB_HOME/bin/nuodb-migrator load --target.url=jdbc:com.nuodb://localhost/test?schema=USER --target.username=dba --target.password=goalie --input.path=/tmp/

### Sample

Here is a sample database dictionary

'default': {
'ENGINE': 'django_pynuodb',
'NAME': 'test',
'DOMAIN_USER': 'domain', # domain credentials
'DBA_USER': 'dba', # database credentials
'DBA_PASSWORD': 'goalie',
'SCHEMA': '', # optional
'HOST': 'localhost',
'PORT': '48004',

Set the `USE_TZ` flag to `False`

USE_TZ = False

### Note

* If you want to add a site to your Django project then you must first delete the site. This is automatically generated by Django with a manually set primary key of 1 and interferes with NuoDB automatically generating further primary keys.

### License

[NuoDB License](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_pynuodb-2.0.4.tar.gz (12.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page