yanand0909 commented on code in PR #26385:
URL: https://github.com/apache/flink/pull/26385#discussion_r2148855624
##########
flink-python/pyflink/table/table_environment.py:
##########
@@ -1074,6 +1131,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.1.0
+ """
+ self._j_tenv.createModel(model_path,
model_descriptor._j_model_descriptor, ignore_if_exists)
+
+ def create_temporary_model(self,
+ model_path: str,
+ model_descriptor: ModelDescriptor,
+ ignore_if_exists: Optional[bool] = False):
+ """
+ Registers the given :class:`~pyflink.table.ModelDescriptor` as a
temporary catalog model
Review Comment:
That is the default behavior for temporary objects. Nothing new specific to
model
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]