Esempio n. 1
0
    def retrieve_aggregated(self, datasource, granularity, entitytype,
            column_identifiers, interval, group_by, subquery_filter=None,
            relation_table_name=None):

        return retrieve_aggregated(self.conn, datasource, granularity, entitytype,
            column_identifiers, interval, group_by, subquery_filter,
            relation_table_name)
    def test_retrieve_aggregate(self):
        granularity = create_granularity("900")

        with closing(self.conn.cursor()) as cursor:
            datasource = name_to_datasource(cursor, "test")
            entitytype = name_to_entitytype(cursor, "Cell")

            TrendStore(datasource, entitytype, granularity, 86400,
                    "table").create(cursor)

        column_expressions = ["COUNT(entity_id)"]

        start = datasource.tzinfo.localize(datetime(2012, 12, 6, 14, 15))
        end = datasource.tzinfo.localize(datetime(2012, 12, 6, 14, 15))

        interval = start, end

        retrieve_aggregated(self.conn, datasource, granularity, entitytype,
            column_expressions, interval, group_by="entity_id")