MCPcopy Create free account
hub / github.com/Loping151/RoverSign / _plugin_tables

Function _plugin_tables

RoverSign/utils/database/auto_migrate.py:29–49  ·  view source on GitHub ↗
(module_name: str)

Source from the content-addressed store, hash-verified

27
28
29def _plugin_tables(module_name: str) -> List:
30 prefix = _plugin_prefix(module_name) + "."
31 names = set()
32 stack = list(SQLModel.__subclasses__())
33 seen_cls = set()
34 while stack:
35 cls = stack.pop()
36 if id(cls) in seen_cls:
37 continue
38 seen_cls.add(id(cls))
39 stack.extend(cls.__subclasses__())
40 table = getattr(cls, "__table__", None)
41 if table is None:
42 continue
43 if (cls.__module__ or "").startswith(prefix):
44 names.add(table.name)
45 return [
46 SQLModel.metadata.tables[name]
47 for name in names
48 if name in SQLModel.metadata.tables
49 ]
50
51
52def _default_clause(column) -> Optional[str]:

Callers 1

auto_add_missing_columnsFunction · 0.85

Calls 1

_plugin_prefixFunction · 0.85

Tested by

no test coverage detected