MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / populate_functions

Method populate_functions

mssqlcli/mssqlcompleter.py:962–984  ·  view source on GitHub ↗

Returns a list of function SchemaObjects. :param filter_func is a function that accepts a FunctionMetadata namedtuple and returns a boolean indicating whether that function should be kept or discarded

(self, schema, filter_func)

Source from the content-addressed store, hash-verified

960 ]
961
962 def populate_functions(self, schema, filter_func):
963 """Returns a list of function SchemaObjects.
964
965 :param filter_func is a function that accepts a FunctionMetadata
966 namedtuple and returns a boolean indicating whether that
967 function should be kept or discarded
968
969 """
970
971 # Because of multiple dispatch, we can have multiple functions
972 # with the same name, which is why `for meta in metas` is necessary
973 # in the comprehensions below
974 return [
975 SchemaObject(
976 name=func,
977 schema=(self._maybe_schema(schema=sch, parent=schema)),
978 meta=meta
979 )
980 for sch in self._get_schemas('functions', schema)
981 for (func, metas) in self.dbmetadata['functions'][sch].items()
982 for meta in metas
983 if filter_func(meta)
984 ]

Callers 1

get_function_matchesMethod · 0.95

Calls 3

_maybe_schemaMethod · 0.95
_get_schemasMethod · 0.95
SchemaObjectFunction · 0.85

Tested by

no test coverage detected