def get_by_id(id, fresh=False): if fresh == True: db_session.remove() sensor =\ db_session.query(Sensor).\ filter(Sensor.id == id).first() return sensor
def get_all(fresh=False): """Returns all the nodes in the database """ if fresh == True: db_session.remove() accounts = db_session.query(Account).all() return accounts
def get_by_name(name, fresh=False): if fresh == True: db_session.remove() account =\ db_session.query(Account).\ filter(Account.account_name == name).first() return account
def get_all(fresh=False): """Returns all the nodes in the database """ if fresh == True: db_session.remove() nodes = db_session.query(Node).all() return nodes
def get_printers(): """Retrieve all printers in the database :returns: TODO """ db_session.remove() l = [] for printer in db_session.query(Printer): l.append(printer) return l
def get_by_id(id, fresh=False): """Returns a job based on id :id: ID of job to be found :returns: Job if id is found, None if didn't exist """ if fresh == True: db_session.remove() job =\ db_session.query(Job).filter(Job.id == id).first() return job
def get_by_id(id, fresh=False): """Returns a node based on id :id: ID of node to be found :returns: Node if id is found, None if didn't exist """ if fresh == True: db_session.remove() node =\ db_session.query(Node).\ filter(Node.id == id).first() return node
def get_by_webid(webid, fresh=False): """Returns a printer based on webid :webid: ID that the web interface uses :returns: Printer if webid is found, None if didn't exist """ if fresh == True: db_session.remove() printer =\ db_session.query(Printer).\ filter(Printer.webid == webid).first() return printer
def get_by_id(id, fresh=False): """Returns a printer based on id :id: ID of printer to be found :returns: Printer if id is found, None if didn't exist """ if fresh == True: db_session.remove() printer =\ db_session.query(Printer).\ filter(Printer.id == id).first() return printer
def get_by_webid(webid, fresh=False): """Returns a job based on webid :webid: WebID of job to be found :returns: Job if webid is found, None if didn't exist """ if fresh == True: db_session.remove() job =\ db_session.query(Job).\ filter(Job.webid == webid).first() return job
def get_all(fresh=False): if fresh == True: db_session.remove() printers = db_session.query(Printer).all() return printers