Using CREATE MODEL | CREATE OR REPLACE MODEL in GCP Dataflow Job

Solution 1:

Following the screenshot, I see you're using the Dataflow SQL console, but you want to create a Bigquery Job from that console. Although having similar syntaxes, Dataflow SQL jobs and Bigquery jobs are not the same, specially considering that such statement only applies to BigQuery ML.

You can find in the documentation for the Dataflow SQL Query Syntax the supported statements, but the CREATE MODEL statement is not within them or other syntaxes for Dataflow SQL, that is only a statement for the BigQuery ML service.

I suggest following an orchestrated approach, so when after the Dataflow job is finished, then a task is executed to create the BigQuery ML model (for which you could use code running on Cloud Function or other approach). For example, for workflow orchestration you can use either Cloud Workflows or Cloud Composer, or any other option you prefer.