コード例 #1
0
        def get_from_database():
            session = DBSession()
            try:
                file = session.query(cls).filter(cls.full_path == filename).order_by(cls.id.desc()).first()
            except NoResultFound:
                file = None

            return file
コード例 #2
0
        def get_from_database():
            session = DBSession()
            try:
                file = session.query(cls).filter(cls.id == base62_decode(base62)).one()
            except NoResultFound:
                file = None

            return file
コード例 #3
0
 def get_from_database():
     session = DBSession()
     try:
         file = session.query(cls).filter(cls.device == device).order_by(cls.date_created.desc()).first()
     except NoResultFound:
         file = None
     
     return file
コード例 #4
0
        def get_from_database():
            devices = []

            session = DBSession()
            for device in session.query(File.device).distinct():
                devices.append(device[0])

            return sorted(devices)
コード例 #5
0
        def get_from_database():
            session = DBSession()
            try:
                file = session.query(cls).filter(cls.md5sum == md5hash).one()
            except NoResultFound:
                file = None

            return file
コード例 #6
0
        def get_from_database():
            session = DBSession()
            query = session.query(cls)

            query = query.select_from(File).filter(cls.type == channel)
            query = query.filter(cls.device == device)
            query = query.filter(cls.date_created >= datetime.fromtimestamp(after))
            query = query.order_by(cls.date_created.desc()).first()

            return query
コード例 #7
0
        def get_from_database():
            session = DBSession()
            query = session.query(cls)

            if device is not None:
                query = query.select_from(File).filter(File.device == device)

            if type is not None:
                query = query.filter(cls.type == type)

            # Limit the query and order it
            query = query.order_by(cls.date_created.desc())[:limit]

            return query