Error while importing u1db-qt created db using python-u1db module

Bug #1505745 reported by Marco A. Harrendorf on 2015-10-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Client Developer Experience
Low
Zoltan Balogh
U1DB
Undecided
Unassigned
U1DB Qt/ QML
Undecided
Unassigned
Utudu
Undecided
Unassigned

Bug Description

Dear all,

I am trying to process the u1db database which was created by the utudu Ubuntu touch application using the python-u1db module.

The Utudu Ubuntu touch application (https://launchpad.net/utudu) is using the u1db-qt package and this part of code in the components/Storage.qml file:

import U1db 1.0 as U1db
...
// Setup the database
    U1db.Database {
        id: db
        path: "utudu.u1db"
    }

    property var db_settings_defaults: {
        "db_version": "1.0",
        "theme": "Gray"
    }

    // Declare a document
    U1db.Document {
        database: db
        docId: "settings"
        id: settings
        create: true
        defaults: db_settings_defaults
    }
....

I tried to import and analyze the Utudu database file which is located in ~/.local/share/com.ubuntu.developer.jdstrand.utudu/utudu.u1db by using the python-u1db module 13.10-5:

import u1db
db = u1db.open(utudu.u1db, create = True)

and getting the following error messages:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/u1db/__init__.py", line 45, in open
    path, create=create, document_factory=document_factory)
  File "/usr/lib/python2.7/dist-packages/u1db/backends/sqlite_backend.py", line 101, in open_database
    sqlite_file, document_factory=document_factory)
  File "/usr/lib/python2.7/dist-packages/u1db/backends/sqlite_backend.py", line 83, in _open_database
    v, err = cls._which_index_storage(c)
  File "/usr/lib/python2.7/dist-packages/u1db/backends/sqlite_backend.py", line 68, in _which_index_storage
    return c.fetchone()[0], None
TypeError: 'NoneType' object has no attribute '__getitem__'

Please note that this error only occurs if I use a database file which was created by using the u1db-qt package.
Furthermore, it is possible to open the utudu.u1db database file using the python-sqlite3 module.

I attach an example utudu.u1db file if you want to debug the behaviour yourself.

Thanks

Changed in canonical-developer-experience:
assignee: nobody → Zoltan Balogh (bzoltan)
status: New → Confirmed

Are there any news on this bug?

Since many apps in Ubuntu Touch are relying on the U1DB it is IMHO really a big obstacle. Especially since I would like to access the U1DB to write a synchronisation python script which would sync the contents of a note app to owncloud.

Pat McGowan (pat-mcgowan) wrote :

This probably isn't getting attention because we do not really support python or the background processing you are attempting.
We are working on a proper data management framework which will eventually provide the hooks you need.

Changed in canonical-developer-experience:
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers