snuyanzin commented on code in PR #26385: URL: https://github.com/apache/flink/pull/26385#discussion_r2031900150
########## flink-python/pyflink/table/table_environment.py: ########## @@ -1071,6 +1128,88 @@ def create_view(self, self._j_tenv.createView(view_path, table, ignore_if_exists) + def create_model(self, + model_path: str, + model_descriptor: ModelDescriptor, + ignore_if_exists: Optional[bool] = False): + """ + Registers the given :class:`~pyflink.table.ModelDescriptor` as a catalog model + similar to SQL models. + + The ModelDescriptor is converted into a CatalogModel and stored in the catalog. + + If the model should not be permanently stored in a catalog, use + :func:`create_temporary_model` instead. + + Examples: + :: + + >>> table_env.create_model("MyModel", ModelDescriptor.for_provider("OPENAI") + ... .input_schema(Schema.new_builder() + ... .column("f0", DataTypes.STRING()) + ... .build()) + ... .output_schema(Schema.new_builder() + ... .column("label", DataTypes.STRING()) + ... .build()) + ... .option("task", "regression") + ... .option("type", "remote") + ... . + ... . + ... .build(), + ... True) + + :param model_path: The path under which the model will be registered. + :param model_descriptor: Template for creating a CatalogModel instance. + :param ignore_if_exists: If a model exists under the given path and this flag is set, + no operation is executed. An exception is thrown otherwise. + + .. versionadded:: 2.0.1 Review Comment: this a wrong branch if we are talking about 2.0.1 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org