influxdbds.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:odata-influxdb 作者: Synergetic-Engineering 项目源码 文件源码
def _query_len(self):
        """influxdb only counts non-null values, so we return the count of the field with maximum non-null values"""
        q = u'SELECT COUNT(*) FROM "{}" {} {}'.format(
            self.measurement_name,
            self._where_expression(),
            self._groupby_expression()
        ).strip()
        self.container.client.switch_database(self.db_name)
        logger.info('Querying InfluxDB: {}'.format(q))
        rs = self.container.client.query(q)
        interval_list = list(rs.get_points())
        if request and request.args.get('aggregate'):
            max_count = len(interval_list)
        else:
            max_count = max(val for val in rs.get_points().next().values() if isinstance(val, numbers.Number))
        self._influxdb_len = max_count
        return max_count
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号