| 759 | |
| 760 | @classmethod |
| 761 | def create_for_statement( |
| 762 | cls, statement: Executable, compiler: SQLCompiler, **kw: Any |
| 763 | ) -> CompileState: |
| 764 | # factory construction. |
| 765 | |
| 766 | if statement._propagate_attrs: |
| 767 | plugin_name = statement._propagate_attrs.get( |
| 768 | "compile_state_plugin", "default" |
| 769 | ) |
| 770 | klass = cls.plugins.get( |
| 771 | (plugin_name, statement._effective_plugin_target), None |
| 772 | ) |
| 773 | if klass is None: |
| 774 | klass = cls.plugins[ |
| 775 | ("default", statement._effective_plugin_target) |
| 776 | ] |
| 777 | |
| 778 | else: |
| 779 | klass = cls.plugins[ |
| 780 | ("default", statement._effective_plugin_target) |
| 781 | ] |
| 782 | |
| 783 | if klass is cls: |
| 784 | return cls(statement, compiler, **kw) |
| 785 | else: |
| 786 | return klass.create_for_statement(statement, compiler, **kw) |
| 787 | |
| 788 | def __init__(self, statement, compiler, **kw): |
| 789 | self.statement = statement |