Possible bug exporting from sqlite database using dumpdata

139 views
Skip to first unread message

Robert Rapplean

unread,
Apr 25, 2016, 6:24:25 PM4/25/16
to Hue-Users
I'm attempting to export the sqlite database as per the instructions on Cloudera's site, and ran into an impasse. Can anyone help me resolve this?

Thanks in advance.

It consistently breaks with the following message:

sudo -u hue /opt/cloudera/parcels/CDH-5.7.0-1.cdh5.7.0.p0.45/lib/hue/build/env/bin/hue  dumpdata > /tmp/huedump.json
CommandError: Unable to serialize database: no such column: search_collection.owner_id

Looking through your source code, I discovered the following lines in 0003_auto__add_field_collection_owner.py:

    def forwards(self, orm):
       
# Adding field 'Collection.owner'
        db
.add_column(u'search_collection', 'owner',
                     
self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['auth.User'], null=True),
                      keep_default
=False)

   
def backwards(self, orm):
       
# Deleting field 'Collection.owner'
        db
.delete_column(u'search_collection', 'owner_id')


Shifting the version forward adds "owner", but going backwards removes "owner_id". This suggests to me that there was some discrepancy about what the field should be called, and whether or not it should exist.

The command to create the search_collection table doesn't mention either owner_id or owner field:

        db.create_table('search_collection', (
            ('properties', self.gf('django.db.models.fields.TextField')(default='{}')),
            ('sorting', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['search.Sorting'])),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=40)),
            ('facets', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['search.Facet'])),
            ('enabled', self.gf('django.db.models.fields.BooleanField')(default=True, blank=True)),
            ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('is_core_only', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
            ('result', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['search.Result'])),
            ('cores', self.gf('django.db.models.fields.TextField')(default='{}')),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
        ))

Nor does the field exist in my current database:

CREATE TABLE "search_collection" (
"properties" text NOT NULL,
"sorting_id" integer NOT NULL,
"name" varchar(40) NOT NULL,
"facets_id" integer NOT NULL,
"enabled" bool NOT NULL,
"label" varchar(100) NOT NULL,
"is_core_only" bool NOT NULL,
"result_id" integer NOT NULL,
"cores" text NOT NULL,
"id" integer NOT NULL PRIMARY KEY);


Robert Rapplean

unread,
Apr 26, 2016, 1:08:30 AM4/26/16
to Hue-Users
I added owner_id to search_collection via the sqlite command line, and that appears to have fixed the problem.

I'm still curious at the inconsistency in the migration code.
Reply all
Reply to author
Forward
0 new messages