(
self,
schema: Optional[str] = None,
filter_names: Optional[Collection[str]] = None,
available: Optional[Collection[str]] = None,
_reflect_info: Optional[_ReflectionInfo] = None,
**kw: Any,
)
| 1960 | table.comment = comment_dict["text"] |
| 1961 | |
| 1962 | def _get_reflection_info( |
| 1963 | self, |
| 1964 | schema: Optional[str] = None, |
| 1965 | filter_names: Optional[Collection[str]] = None, |
| 1966 | available: Optional[Collection[str]] = None, |
| 1967 | _reflect_info: Optional[_ReflectionInfo] = None, |
| 1968 | **kw: Any, |
| 1969 | ) -> _ReflectionInfo: |
| 1970 | kw["schema"] = schema |
| 1971 | |
| 1972 | if filter_names and available and len(filter_names) > 100: |
| 1973 | fraction = len(filter_names) / len(available) |
| 1974 | else: |
| 1975 | fraction = None |
| 1976 | |
| 1977 | unreflectable: Dict[TableKey, exc.UnreflectableTableError] |
| 1978 | kw["unreflectable"] = unreflectable = {} |
| 1979 | |
| 1980 | has_result: bool = True |
| 1981 | |
| 1982 | def run( |
| 1983 | meth: Any, |
| 1984 | *, |
| 1985 | optional: bool = False, |
| 1986 | check_filter_names_from_meth: bool = False, |
| 1987 | ) -> Any: |
| 1988 | nonlocal has_result |
| 1989 | # simple heuristic to improve reflection performance if a |
| 1990 | # dialect implements multi_reflection: |
| 1991 | # if more than 50% of the tables in the db are in filter_names |
| 1992 | # load all the tables, since it's most likely faster to avoid |
| 1993 | # a filter on that many tables. |
| 1994 | if ( |
| 1995 | fraction is None |
| 1996 | or fraction <= 0.5 |
| 1997 | or not self.dialect._overrides_default(meth.__name__) |
| 1998 | ): |
| 1999 | _fn = filter_names |
| 2000 | else: |
| 2001 | _fn = None |
| 2002 | try: |
| 2003 | if has_result: |
| 2004 | res = meth(filter_names=_fn, **kw) |
| 2005 | if check_filter_names_from_meth and not res: |
| 2006 | # method returned no result data. |
| 2007 | # skip any future call methods |
| 2008 | has_result = False |
| 2009 | else: |
| 2010 | res = {} |
| 2011 | except NotImplementedError: |
| 2012 | if not optional: |
| 2013 | raise |
| 2014 | res = {} |
| 2015 | return res |
| 2016 | |
| 2017 | info = _ReflectionInfo( |
| 2018 | columns=run( |
| 2019 | self.get_multi_columns, check_filter_names_from_meth=True |
no test coverage detected