Ejemplo n.º 1
0
 def get_config_unit(self, ccs_id):
     with self.get_session() as session:
         cols = [ConfigUnit.ccs_id, ConfigUnit.name, ConfigUnit.category, ConfigUnit.content]
         data = session.query(ConfigUnit).filter_by(ccs_id=ccs_id)
         conf = []
         for row in data:
             conf.append(extract_columns(row, cols))
         return conf
Ejemplo n.º 2
0
 def get_models(self, ccs_id):
     with self.get_session() as session:
         cols = [CcsModel.id, CcsModel.ccs_id, CcsModel.name, CcsModel.url, CcsModel.method, CcsModel.category]
         data = session.query(CcsModel).filter_by(ccs_id=ccs_id)
         conf = []
         for row in data:
             conf.append(extract_columns(row, cols))
         return conf
Ejemplo n.º 3
0
 def get_bot(self, bid):
     with self.get_session() as session:
         cols = [
             CcsBot.id, CcsBot.ccs_id, CcsBot.name, CcsBot.url,
             CcsBot.app_id, CcsBot.modules
         ]
         bid = session.query(CcsBot).get(bid)
         bot = extract_columns(bid, cols)
         if bot['modules']:
             bot['modules'] = json.loads(bot['modules'])
         else:
             del bot['modules']
         return bot
Ejemplo n.º 4
0
 def get_bots(self, ccs_id):
     with self.get_session() as session:
         cols = [
             CcsBot.id, CcsBot.ccs_id, CcsBot.name, CcsBot.url,
             CcsBot.modules, CcsBot.app_id
         ]
         data = session.query(CcsBot).filter_by(ccs_id=ccs_id)
         conf = []
         for row in data:
             bot = extract_columns(row, cols)
             if bot['modules']:
                 bot['modules'] = json.loads(bot['modules'])
             else:
                 del bot['modules']
             conf.append(bot)
         return conf
Ejemplo n.º 5
0
 def get_by_id(self, uid):
     with self.get_session() as session:
         cols = [ConfigUnit.id, ConfigUnit.name, ConfigUnit.category, ConfigUnit.content]
         config = session.query(ConfigUnit).get(uid)
         return extract_columns(config, cols)
Ejemplo n.º 6
0
 def get_model(self, mid):
     with self.get_session() as session:
         cols = [CcsModel.id, CcsModel.ccs_id, CcsModel.name, CcsModel.url, CcsModel.method]
         mid = session.query(CcsModel).get(mid)
         return extract_columns(mid, cols)