diff --git a/evadb/catalog/catalog_manager.py b/evadb/catalog/catalog_manager.py index 70d3e0acf..a788c3040 100644 --- a/evadb/catalog/catalog_manager.py +++ b/evadb/catalog/catalog_manager.py @@ -515,6 +515,20 @@ def get_function_catalog_entry_by_name(self, name: str) -> FunctionCatalogEntry: """ return self._function_service.get_entry_by_name(name) + def get_function_catalog_entries_by_type( + self, type: str + ) -> List[FunctionCatalogEntry]: + """ + Get function information based on type. + + Arguments: + type (str): type of the function + + Returns: + List of FunctionCatalogEntry object + """ + return self._function_service.get_entries_by_type(type) + def delete_function_catalog_entry_by_name(self, function_name: str) -> bool: return self._function_service.delete_entry_by_name(function_name) diff --git a/evadb/catalog/services/function_catalog_service.py b/evadb/catalog/services/function_catalog_service.py index 0c6c272d3..c1244da1b 100644 --- a/evadb/catalog/services/function_catalog_service.py +++ b/evadb/catalog/services/function_catalog_service.py @@ -100,6 +100,24 @@ def get_entry_by_name(self, name: str) -> FunctionCatalogEntry: return function_obj.as_dataclass() return None + def get_entries_by_type(self, function_type: str) -> List[FunctionCatalogEntry]: + """returns the function entries that matches the type provided. + Empty list if no such entry found. + + Arguments: + type (str): name to be searched + """ + + entries = ( + self.session.execute( + select(self.model).filter(self.model._type == function_type) + ) + .scalars() + .all() + ) + + return [entry.as_dataclass() for entry in entries] + def get_entry_by_id(self, id: int, return_alchemy=False) -> FunctionCatalogEntry: """return the function entry that matches the id provided. None if no such entry found.