When I need a new Cursor() for a database, I have at least 2 ways to initialize a new one.
Using the helpers functions in `openerp.pooler`:
cr = openerp.pooler.get_db('name_of_my_database').cursor() # or
db, pool = openerp.pooler.get_db_and_pool('name_of_my_database')
cr = db.cursor()
Or using `openerp.sql_db.db_connect`:
cr = openerp.sql_db.db_connect('name_of_my_database').cursor()
Note that both are used in OpenERP server or addons.
What is the difference between them and for which use case should I use one or the other function?
↧