04-23-2020 12:33 AM - edited 04-23-2020 12:33 AM
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?
Solved! Go to Solution.
04-23-2020 12:50 AM - edited 04-23-2020 12:51 AM
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
04-23-2020 12:50 AM - edited 04-23-2020 12:51 AM
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
04-23-2020 02:16 AM - edited 04-23-2020 02:17 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide