| 2147 | |
| 2148 | @util.preload_module("sqlalchemy.sql.functions") |
| 2149 | def _init( # type: ignore[override] |
| 2150 | self, |
| 2151 | selectable: Any, |
| 2152 | *, |
| 2153 | name: Optional[str] = None, |
| 2154 | sampling: Union[float, Function[Any]], |
| 2155 | seed: Optional[roles.ExpressionElementRole[Any]] = None, |
| 2156 | ) -> None: |
| 2157 | assert sampling is not None |
| 2158 | functions = util.preloaded.sql_functions |
| 2159 | if not isinstance(sampling, functions.Function): |
| 2160 | sampling = functions.func.system(sampling) |
| 2161 | |
| 2162 | self.sampling: Function[Any] = sampling |
| 2163 | self.seed = seed |
| 2164 | super()._init(selectable, name=name) |
| 2165 | |
| 2166 | def _get_method(self) -> Function[Any]: |
| 2167 | return self.sampling |