def __get_itemtimes(self): with dictcursor() as cur: cur.execute( "SELECT display_time,ARRAY_AGG(item_id) as items FROM content_item,contenttime_item WHERE content_id=%s and content_item.id=contenttime_item.contenttime_id GROUP BY content_item.id", (self.id,)) dbtuple = cur.fetchall() return dbtuple
def contents(self): with dictcursor() as cur: cur.execute( "SELECT creator.name,content.title,content.id FROM creator,content WHERE content.id in (SELECT content_id FROM content_item WHERE content_item.id in (SELECT contenttime_id FROM contenttime_item WHERE item_id=%s) GROUP BY content_id) and creator.id = content.creator_id", (self.id,)) dbtuple = cur.fetchall() return dbtuple
def item_info(self): with dictcursor() as cur: cur.execute( "SELECT item.id, item.price, item.color FROM item WHERE item.id=%s", (self.id,)) data = cur.fetchone() data["ratio"] = image_ratio(self.product_image_path) return data
def db_info(self): contents_list = tuple(self._contents_order.keys()) with dictcursor() as cur: cur.execute( "SELECT content.id,title,name,mobile_info FROM content,creator WHERE content.creator_id=creator.id and content.id IN %s;", (contents_list,) ) dbtuple = cur.fetchall() return dbtuple
def get_info(self): with dictcursor() as cur: cur.execute( "SELECT content.id,title,name FROM content,creator WHERE content.creator_id=creator_id and content.id=%s;", (self.id,)) dbtuple = cur.fetchall()