code: def set_database(db_url, proxy, config):
      
      db_config = config.get('results_database', {}).get('params', {})
  
      if 'testing' in config and config['testing'] is True:
          database = connect('sqlite:////tmp/results.sqlite', check_same_thread=False, threadlocals=True)
      else:
          if os.path.isfile(db_url) or os.path.isdir(os.path.dirname(db_url)):
              db_url = "sqlite:///" + db_url
              db_config.update(check_same_thread=False, threadlocals=True)
          database = connect(db_url, **db_config)
      proxy.initialize(database)
docs: Initialize the peewee database with the given configuration
  
      If the given db_url is a regular file, it will be used as sqlite database
  
      :param str db_url: the connection string for database or path if sqlite file
      :param peewee.Proxy proxy: the peewee proxy to initialise
      :param dict config: the configuration dictionnary