예제 #1
0
    def execute(cls, **kwargs):
        ids_orgaos = kwargs.get("ids_orgaos")
        prep_stat = {f"id_orgao_{i}": v for i, v in enumerate(ids_orgaos)}
        kwargs["ids_orgaos"] = prep_stat

        params = ",".join([f":id_orgao_{i}" for i in range(len(ids_orgaos))])
        query = cls.query().replace(":ids_orgaos", params)
        return impala_execute(query, prep_stat)
예제 #2
0
 def select(self, columns, parameters):
     # TODO: criar um método genérico para formatar a query
     query = "SELECT {projection} FROM {table_name} WHERE {0} = :{0}"
     f_query = query.format(
         projection=", ".join(columns),
         table_name=self.table_name,
         *parameters.keys(),
     )
     return impala_execute(f_query, parameters)
예제 #3
0
    def execute(cls, **kwargs):
        dks = kwargs['dks']

        data = {f"documento_{i}": v for i, v in enumerate(dks)}
        kwargs.update(data)

        params = ",".join([f":{k}" for k in data.keys()])
        query = cls.query().replace(":dks", params)

        return impala_execute(query, kwargs)
예제 #4
0
    def execute(cls, **kwargs):
        orgao_id = kwargs['orgao_id']
        _, orgaos = get_orgaos_same_aisps(orgao_id)

        data = {f"orgao_aisp_{i}": v for i, v in enumerate(orgaos)}
        kwargs.update(data)

        params = ",".join([f":{k}" for k in data.keys()])
        query = cls.query().replace(":orgaos_aisp", params)

        return impala_execute(query, kwargs)
예제 #5
0
 def execute(self, **kwargs):
     return impala_execute(
         super().query().format(nm_campo=self.ranking_fieldname),
         kwargs
     )
예제 #6
0
 def execute(cls, **kwargs):
     oracle_data = oracle_access(cls.query(cls.query_oracle), kwargs)
     impala_data = impala_execute(cls.query(cls.query_impala), kwargs)
     return oracle_data + impala_data
예제 #7
0
 def execute(cls, **kwargs):
     return impala_execute(cls.query(), kwargs)