Example #1
0
    def get_items_features(self):  #_using_decorator(self):

        print("------>doamin***********", get_schema())
        Item.__table__.schema = get_schema()

        items = Item.query.all()
        number_of_features = Genre().count()
        return FeaturesToTensor(
            DFToFeatures(
                DictToDataFrame(DbToDict(Default(items), self.columns)),
                number_of_features, 'genres')).operation()
Example #2
0
    def get_item_names(self):
        Item.__table__.schema = get_schema()
        items = Item.query.all()
        titles = []
        for item in items:
            titles.append(item.title)

        return titles
Example #3
0
  def get_usernames(self):
    User.__table__.schema = get_schema()

    users = User.query.all()
    user_list = []
    for user in users:
      user_list.append(user.username)

    return user_list
Example #4
0
  def all_users(self):
    User.__table__.schema = get_schema()
    users = User.query.all()
    user_list = []
    for user in users:
      d1["id"] = user.id
      d1["usernam"] = user.username
      user_list.append(d1)

    return user_list
Example #5
0
    def all_user_ratings(self):
        Rating.__table__.schema = get_schema()
        all_ratings = Rating.query.all()
        ratings = []
        for rating in all_ratings:
            data = {}
            data["user_id"] = rating.user_id
            data["item_id"] = rating.item_id
            data["rating"] = rating.rating
            ratings.append(data)

        return ratings
Example #6
0
    def all_items(self):
        Item.__table__.schema = get_schema()
        items = Item.query.all()
        data = []
        titles = []

        for item in items:
            for k in ['id', 'title', 'genres']:
                d1 = {}
                d1[k] = getattr(item, k)

            data.append(d1)
            titles.append(item.title)

        return data, titles
Example #7
0
 def count(self):
   User.__table__.schema = get_schema()
   return User.query.count()
Example #8
0
 def count(self):
     Item.__table__.schema = get_schema()
     return Item.query.count()