def get_series(self, path, requestContext=None): tags = {} tags = self.r.hgetall('series:' + path + ':tags') if not tags: return None return TaggedSeries(tags['name'], tags)
def get_series(self, path): with connection.cursor() as cursor: sql = 'SELECT s.id, t.tag, v.value' sql += ' FROM tags_series AS s' sql += ' JOIN tags_seriestag AS st ON st.series_id=s.id' sql += ' JOIN tags_tag AS t ON t.id=st.tag_id' sql += ' JOIN tags_tagvalue AS v ON v.id=st.value_id' sql += ' WHERE s.path=%s' params = [path] cursor.execute(sql, params) series_id = None tags = {tag: value for (series_id, tag, value) in cursor} if not tags: return None return TaggedSeries(tags['name'], tags, series_id=series_id)