| 2095 | |
| 2096 | @util.preload_module("sqlalchemy.sql.functions") |
| 2097 | def _init( # type: ignore[override] |
| 2098 | self, |
| 2099 | selectable: Any, |
| 2100 | *, |
| 2101 | name: Optional[str] = None, |
| 2102 | sampling: Union[float, Function[Any]], |
| 2103 | seed: Optional[roles.ExpressionElementRole[Any]] = None, |
| 2104 | ) -> None: |
| 2105 | assert sampling is not None |
| 2106 | functions = util.preloaded.sql_functions |
| 2107 | if not isinstance(sampling, functions.Function): |
| 2108 | sampling = functions.func.system(sampling) |
| 2109 | |
| 2110 | self.sampling: Function[Any] = sampling |
| 2111 | self.seed = seed |
| 2112 | super()._init(selectable, name=name) |
| 2113 | |
| 2114 | def _get_method(self) -> Function[Any]: |
| 2115 | return self.sampling |