cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
318
Views
0
Helpful
2
Replies
Highlighted
Beginner

Cobra SDK - QueryError: Unable to process the query, result dataset is too big

Hi, 

I try to run a python script to do a query in apic database for class l1PhysIf to obtain a port inventory, code seems to be ok, but when I execute code I get error:

 

cobra.mit.request.QueryError: Unable to process the query, result dataset is too big

 

in my code I use a for loop for append query's obtained data to a empty list

my fabric has about 6900 ports so query results can be big, how can handle the code for obtain the data?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
VIP Engager

Hi @Alberto Seg 

The error you see is generated by APIC when the response data is too big. To lower the size of the return data, you need to use paging (I hope that is the correct wording).

I never set the page size in cobra, but it seems there are properties you can set: https://cobra.readthedocs.io/en/latest/_modules/cobra/mit/request.html 

 

  @property
    def pageSize(self):
        """Get the pageSize value.

        Returns:
          int: The number of results to be returned by a query.
        """
        return self.__options.get('page-size', None)

    @pageSize.setter
    def pageSize(self, pageSize):
        """Set the pageSize value.

        Args:
          pageSize (int): The number of results to be returned by a query.
        """
        try:
            numVal = int(pageSize)
        except:
            raise ValueError('{} pageSize needs to be an integer'.format(pageSize))
        self.__options['page-size'] = str(numVal)

 

Regards,

Sergiu

 

 

View solution in original post

2 REPLIES 2
Highlighted
VIP Engager

Hi @Alberto Seg 

The error you see is generated by APIC when the response data is too big. To lower the size of the return data, you need to use paging (I hope that is the correct wording).

I never set the page size in cobra, but it seems there are properties you can set: https://cobra.readthedocs.io/en/latest/_modules/cobra/mit/request.html 

 

  @property
    def pageSize(self):
        """Get the pageSize value.

        Returns:
          int: The number of results to be returned by a query.
        """
        return self.__options.get('page-size', None)

    @pageSize.setter
    def pageSize(self, pageSize):
        """Set the pageSize value.

        Args:
          pageSize (int): The number of results to be returned by a query.
        """
        try:
            numVal = int(pageSize)
        except:
            raise ValueError('{} pageSize needs to be an integer'.format(pageSize))
        self.__options['page-size'] = str(numVal)

 

Regards,

Sergiu

 

 

View solution in original post

Highlighted

Thanks, with this parameter I have been able to limit the query size and obtain results, but is curious because I would have to obtain 6972 results and if I don´t set the size query said is too big, however, If I set size to 7000 it´s return the complete results with 6972 values.

 

thanks

Content for Community-Ad

This widget could not be displayed.