def find(cls, id): with dwms_db.cursor() as c: c.execute('SELECT task_name FROM develop_task WHERE id = %s', (id,)) row = c.fetchone() if row is None: return None return DevelopTask(**row)
def find_by_server_name(cls, server_name): with dwms_db.cursor() as c: c.execute('SELECT id, server_name, host, port, username, password FROM server' \ ' WHERE server_name = %s AND status = %s AND server_type = %s LIMIT 1', (server_name, cls.STATUS_ONLINE, cls.SERVER_TYPE_ETL)) row = c.fetchone() if row is None: return None return Server(**row)