MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / automap_base

Function automap_base

lib/sqlalchemy/ext/automap.py:1422–1458  ·  view source on GitHub ↗

r"""Produce a declarative automap base. This function produces a new base class that is a product of the :class:`.AutomapBase` class as well a declarative base produced by :func:`.declarative.declarative_base`. All parameters other than ``declarative_base`` are keyword arguments

(
    declarative_base: Optional[Type[Any]] = None, **kw: Any
)

Source from the content-addressed store, hash-verified

1420
1421
1422def automap_base(
1423 declarative_base: Optional[Type[Any]] = None, **kw: Any
1424) -> Any:
1425 r"""Produce a declarative automap base.
1426
1427 This function produces a new base class that is a product of the
1428 :class:`.AutomapBase` class as well a declarative base produced by
1429 :func:`.declarative.declarative_base`.
1430
1431 All parameters other than ``declarative_base`` are keyword arguments
1432 that are passed directly to the :func:`.declarative.declarative_base`
1433 function.
1434
1435 :param declarative_base: an existing class produced by
1436 :func:`.declarative.declarative_base`. When this is passed, the function
1437 no longer invokes :func:`.declarative.declarative_base` itself, and all
1438 other keyword arguments are ignored.
1439
1440 :param \**kw: keyword arguments are passed along to
1441 :func:`.declarative.declarative_base`.
1442
1443 """
1444 if declarative_base is None:
1445 Base = _declarative_base(**kw)
1446 else:
1447 Base = declarative_base
1448
1449 return type(
1450 Base.__name__,
1451 (AutomapBase, Base),
1452 {
1453 "__abstract__": True,
1454 "classes": util.Properties({}),
1455 "by_module": util.Properties({}),
1456 "_sa_automapbase_bookkeeping": _Bookkeeping(set()),
1457 },
1458 )
1459
1460
1461def _is_many_to_many(

Calls 1

_BookkeepingClass · 0.85