def setConnection(uri, tables, encoding='utf8', debug=False):
 kw = {}
 _uriLower = uri.lower()
 if _uriLower.startswith('mysql'):
  kw['use_unicode'] = 1
  kw['charset'] = encoding
  kw['local_infile'] = 1
 conn = connectionForURI(uri, **kw)
 conn.debug = debug
 for table in tables:
  table.setConnection(conn)
  table._cacheValue = False
 conn.paramstyle = conn.module.paramstyle
 return conn

def setConnection ( uri , tables , encoding = 'utf8' , debug = False ) : kw = { } _uriLower = uri . lower ( ) if _uriLower . startswith ( 'mysql' ) : kw [ 'use_unicode' ] = 1 kw [ 'charset' ] = encoding kw [ 'local_infile' ] = 1 conn = connectionForURI ( uri , ** kw ) conn . debug = debug for table in tables : table . setConnection ( conn ) table . _cacheValue = False conn . paramstyle = conn . module . paramstyle return conn
set connection for every table .