Esempio n. 1
0
        def get_values(dimension, level):
            cursor_dwh = dw_connect.cursor()

            sql = "SELECT distinct(%s) FROM td_%s" % (level, dimension)
            cursor_dwh.execute(sql)

            return [str(x[0]) for x in cursor_dwh.fetchall()]
Esempio n. 2
0
    def exec_sql(self, sql):
        '''
        Ejecuta el sql y devuelve el resultado
        '''
        cursor_dwh = dw_connect.cursor()
        cursor_dwh.execute(sql)

        if cursor_dwh.rowcount > too_many_rows:
            rows = cursor_dwh.rowcount
            raise CubeTooBig(0, rows)

        return cursor_dwh.fetchall()
Esempio n. 3
0
    def dimension_values(self, axis, cubiculo):
        '''
        Devuelve los valores de un eje de un cubiculo
        '''
        cursor_dwh = dw_connect.cursor()

        sql_dimension_values = cubiculo.dimension_values(int(axis))
        cursor_dwh.execute(sql_dimension_values)
        axis_values = cursor_dwh.fetchall()
        axis_values = [x[0]  for x in axis_values]

        return axis_values
Esempio n. 4
0
    def dimension_values(self, axis):
        '''
        Devuelve los valores de un eje de un cubiculo
        >>> r = Report1("test", "tiempo", "pieza", "anio", "pieza", "{'anio': ['2006']}", "{'grupo_constructivo': ['184']}", "[]", "mismo_valor", "[]", "same_cube", "[]")
        >>> r.dimension_values(1)
        ['184-0-14-71', '184-0-63-80', '184-0-65-80', '184-0-67-25', '184-0-84-25', '184-0-93-80', '184-0-97-80', '184-1-35-25', '184-1-39-25', '184-1-58-25', '184-3-33-1', '184-102-1-1', '184-102-5-1', '184-112-0-61', '184-112-2-61', '184-112-2-80', '184-112-3-61', '184-166-2-80', '184-266-3-80', '184-312-10-79', '184-314-3-8', '184-314-3-79', '184-322-0-56', '184-327-2-80', '184-343-0-25', '184-343-72-25', '184-345-0-25', '184-352-1-71', '184-352-3-29', '184-352-9-8', '184-355-0-32', '184-355-4-80', '184-364-2-80', '184-364-3-80', '184-366-1-25', '184-366-2-25', '184-403-1-32', '184-457-0-8', '184-601-1-32', '184-601-5-80', '184-611-2-80', '184-616-12-80', '184-616-15-80', '184-616-16-80']
        >>> r.dimension_values(0)
        [2006]
        >>>
        '''
        cursor_dwh = dw_connect.cursor()

        sql_dimension_values = self.cubiculo.dimension_values(int(axis))
        cursor_dwh.execute(sql_dimension_values)
        axis_values = cursor_dwh.fetchall()
        axis_values = [x[0]  for x in axis_values]

        return axis_values