This question has been flagged
1 Reply
8407 Views

Hello I created an external DB Source with module base_external_dbsource and can connect successfully to that source. But Now I would like to read data from an external source in my custom module and don't now how to use this db-source in my module to read data from external db on the fly. Can someone give me a code-example how to use this db-source in a custom module? Thanks Rene

Avatar
Discard
Best Answer

Have a look at the import_odbc module.

Based on that I extracted this code:

db_model = self.pool.get('base.external.dbsource')
res = db_model.execute(cr, uid, [<dbsource_id>], <sql_query>, <sql_params>)
for row in res['rows']:
    print row
Avatar
Discard