Example #1
0
 def fetch_conn(cls, **filter_args):
     with session_init() as session:
         connection_array = session.query(ConnectionBase).filter_by(
             **filter_args)
         for conn in connection_array:
             session.expunge(conn)
     return connection_array
Example #2
0
 def delete_conn(self):
     with session_init() as session:
         session.add(self.conn_base)
         session.delete(self.conn_base)
         session.flush()
         delete_id = self.conn_base.id
     self.conn_base = None
     return delete_id
Example #3
0
 def __init__(self, **kwargs):
     if 'id' in kwargs:
         with session_init() as session:
             _trans = session.query(TransformBase).filter_by(id=kwargs['id']).first()
             session.expunge(_trans)
         self.trans_base = _trans
     else:
         self.trans_base = TransformBase(**kwargs)
Example #4
0
 def delete_filter(self):
     with session_init() as session:
         session.add(self.filter_base)
         session.delete(self.filter_base)
         session.flush()
         delete_id = self.filter_base.id
     self.filter_base = None
     return delete_id
Example #5
0
 def __init__(self, **kwargs):
     if "id" in kwargs:
         with session_init() as session:
             _filter = session.query(FilterBase).filter_by(
                 id=kwargs["id"]).first()
             session.expunge(_filter)
         self.filter_base = _filter
     else:
         self.filter_base = FilterBase(**kwargs)
Example #6
0
 def __init__(self, **kwargs):
     if "id" in kwargs:
         with session_init() as session:
             _connection = (session.query(ConnectionBase).filter_by(
                 id=kwargs["id"]).first())
             session.expunge(_connection)
         self.conn_base = _connection
     elif all(x in kwargs for x in ("name", "host")):
         self.conn_base = ConnectionBase(**kwargs)
         self.conn_base.password = self.__encode_passwd(
             self.conn_base.password).decode("ascii")
Example #7
0
    def create_filter(self):
        if self.filter_base.filter_type == "feedback":
            res = all(
                hasattr(self.filter_base, x)
                for x in ["operation", "field", "conn_id", "table"])
        elif hasattr(self.filter_base, "value"):
            res = True
        else:
            res = False

        if res:
            with session_init() as session:
                session.add(self.filter_base)
                session.flush()
                session.refresh(self.filter_base)
                session.expunge(self.filter_base)
Example #8
0
 def list_conn(cls):
     with session_init() as session:
         connection_array = session.query(ConnectionBase).all()
         for conn in connection_array:
             session.expunge(conn)
     return connection_array
Example #9
0
 def create_conn(self):
     with session_init() as session:
         session.add(self.conn_base)
         session.flush()
         session.refresh(self.conn_base)
         session.expunge(self.conn_base)
Example #10
0
 def create_transform(self):
     with session_init() as session:
         session.add(self.trans_base)
         session.flush()
         session.refresh(self.trans_base)
         session.expunge(self.trans_base)
Example #11
0
 def fetch_filter(cls, **filter_args):
     with session_init() as session:
         filter_array = session.query(FilterBase).filter_by(**filter_args)
         for _filter in filter_array:
             session.expunge(_filter)
     return filter_array
Example #12
0
 def list_filter(cls):
     with session_init() as session:
         filter_array = session.query(FilterBase).all()
         for _filter in filter_array:
             session.expunge(_filter)
     return filter_array