Wednesday, September 19, 2012

Import ODBC module steps up

The import_odbc module for OpenERP was recently improved and moved  to the OpenObject Extension community project. the original module is now split in two: base_external_dbsource and import_odbc.

The import_odbc code was refactored, but keeps the same funcionality as before. Documentation was improved and some examples are provided out of the box.

The base_external_dbsource was created to isolate the logic for connecting to external databases and executing SQL queries. It's used by import_odbc, but it also enables other modules to fetch foreign data on the fly.

Additionally, the connection types supported were extended. Support for ODBC and Oracle native connections is kept, and support for other native connections was added:
  • MS SQL Server
  • MySQL
  • PostgreSQL
  • SQLite
With this evolution, it would be more fair to name the module as "import_sql" instead of the "import_odbc", but the name was kept unchanged to avoid confusing current users.

You can get the latest version of these modules from the OpenObject Extension trunk branch:
bzr branch lp:openobject-extension

Share you experiences and feature wishlists with us!


  1. Hi, I'm triying to import data from external Mysql DB

    I've configured correctly the connection with the server.

    I have create a new model to include the data I will import.

    How I have to do the SELECT statement?

    I'm getting this error for a simple SELECT X AS Z from Y;

    Z = is the name of the column in which I want to put this data.

    Client Traceback (most recent call last):
    File "/opt/openerp/server/openerp/addons/web/common/", line 180, in dispatch
    response["result"] = method(controller, self, **self.params)
    File "/opt/openerp/server/openerp/addons/web/controllers/", line 1052, in call_button
    action = self.call_common(req, model, method, args, domain_id, context_id)
    File "/opt/openerp/server/openerp/addons/web/controllers/", line 996, in call_common
    return self._call_kw(req, model, method, args, {})
    File "/opt/openerp/server/openerp/addons/web/controllers/", line 1010, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
    File "/opt/openerp/server/openerp/addons/web/common/openerplib/", line 250, in proxy
    args, kw)
    File "/opt/openerp/server/openerp/addons/web/common/openerplib/", line 117, in proxy
    result = self.connector.send(self.service_name, method, *args)
    File "/opt/openerp/server/openerp/addons/web/common/", line 608, in send
    raise xmlrpclib.Fault(, formatted_info)

    Server Traceback (most recent call last):
    File "/opt/openerp/server/openerp/addons/web/common/", line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
    File "/opt/openerp/server/openerp/", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
    File "/opt/openerp/server/openerp/service/", line 586, in dispatch
    res = fn(db, uid, *params)
    File "/opt/openerp/server/openerp/osv/", line 186, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
    File "/opt/openerp/server/openerp/osv/", line 129, in wrapper
    return f(self, dbname, *args, **kwargs)
    File "/opt/openerp/server/openerp/osv/", line 195, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/opt/openerp/server/openerp/osv/", line 183, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
    File "/opt/openerp/server/openerp/addons/import_odbc/", line 187, in import_run
    self.write(cr, uid, [], log)
    File "/opt/openerp/server/openerp/osv/", line 3927, in write
    'where id IN %s', upd1 + [sub_ids])
    File "/opt/openerp/server/openerp/", line 152, in wrapper
    return f(self, *args, **kwargs)
    File "/opt/openerp/server/openerp/", line 212, in execute
    res = self._obj.execute(query, params)
    InternalError: current transaction is aborted, commands ignored until end of transaction block

  2. Hi. The "InternalError: current transaction is aborted" error does not bring me any immediate idea of what might be wrong. I suggest you report a bug at Maybe a contributor using MySQL can be helpful on this.

  3. Hi,
    I am trying to connect to Oracle database using base_external_dbsource. I am successfully installed that module and cx_Oracle inorder to communicate with Python.
    I can import cx_Oracle in Pythonshell using terminal, But i am getting an error while i am using eclipse :"ImportError: cannot open shared object file: No such file or directory"
    Please give me a solution.. Thank you.

    1. Sorry, I'm not an Eclipse user and I haven't found that error before, so I'm afraid I can't help.