module documentation

Undocumented

Function ​_scan​_declarative​_assignment​_stmt Extract mapping information from an assignment statement in a declarative class.
Function ​_scan​_declarative​_decorator​_stmt Extract mapping information from a @declared_attr in a declarative class.
Function ​_scan​_for​_mapped​_bases Given a class, iterate through its superclass hierarchy to find all other classes that are considered as ORM-significant.
Function ​_scan​_symbol​_table​_entry Extract mapping information from a SymbolTableNode that's in the type.names dictionary.
Function scan​_declarative​_assignments​_and​_apply​_types Undocumented
def _scan_declarative_assignment_stmt(cls, api, stmt, attributes):
Extract mapping information from an assignment statement in a declarative class.
Parameters
api:SemanticAnalyzerPluginInterfaceUndocumented
stmt:AssignmentStmtUndocumented
attributes:List[util.SQLAlchemyAttribute]Undocumented
def _scan_declarative_decorator_stmt(cls, api, stmt, attributes):

Extract mapping information from a @declared_attr in a declarative class.

E.g.:

@reg.mapped
class MyClass:
    # ...

    @declared_attr
    def updated_at(cls) -> Column[DateTime]:
        return Column(DateTime)

Will resolve in mypy as:

@reg.mapped
class MyClass:
    # ...

    updated_at: Mapped[Optional[datetime.datetime]]
Parameters
api:SemanticAnalyzerPluginInterfaceUndocumented
stmt:DecoratorUndocumented
attributes:List[util.SQLAlchemyAttribute]Undocumented
def _scan_for_mapped_bases(cls, api):

Given a class, iterate through its superclass hierarchy to find all other classes that are considered as ORM-significant.

Locates non-mapped mixins and scans them for mapped attributes to be applied to subclasses.

Parameters
api:SemanticAnalyzerPluginInterfaceUndocumented
def _scan_symbol_table_entry(cls, api, name, value, attributes):
Extract mapping information from a SymbolTableNode that's in the type.names dictionary.
Parameters
api:SemanticAnalyzerPluginInterfaceUndocumented
name:strUndocumented
value:SymbolTableNodeUndocumented
attributes:List[util.SQLAlchemyAttribute]Undocumented
def scan_declarative_assignments_and_apply_types(cls, api, is_mixin_scan=False):

Undocumented

Parameters
api:SemanticAnalyzerPluginInterfaceUndocumented
is​_mixin​_scan:boolUndocumented
Returns
Optional[List[util.SQLAlchemyAttribute]]Undocumented