| 747 | |
| 748 | @classmethod |
| 749 | def create_for_statement( |
| 750 | cls, statement: Executable, compiler: SQLCompiler, **kw: Any |
| 751 | ) -> CompileState: |
| 752 | # factory construction. |
| 753 | |
| 754 | if statement._propagate_attrs: |
| 755 | plugin_name = statement._propagate_attrs.get( |
| 756 | "compile_state_plugin", "default" |
| 757 | ) |
| 758 | klass = cls.plugins.get( |
| 759 | (plugin_name, statement._effective_plugin_target), None |
| 760 | ) |
| 761 | if klass is None: |
| 762 | klass = cls.plugins[ |
| 763 | ("default", statement._effective_plugin_target) |
| 764 | ] |
| 765 | |
| 766 | else: |
| 767 | klass = cls.plugins[ |
| 768 | ("default", statement._effective_plugin_target) |
| 769 | ] |
| 770 | |
| 771 | if klass is cls: |
| 772 | return cls(statement, compiler, **kw) |
| 773 | else: |
| 774 | return klass.create_for_statement(statement, compiler, **kw) |
| 775 | |
| 776 | def __init__(self, statement, compiler, **kw): |
| 777 | self.statement = statement |