BigQuery UI验证器误报DROP MODEL错误 无法创建计划查询
Issue Overview
When trying to set up a scheduled query to delete a BigQuery ML model, I ran into an unexpected validation error. The DDL statement recommended in the official docs:
DROP MODEL IF EXISTS `my_data.sample_model`
was flagged by the BigQuery UI validator with the error "training options cannot be empty". Even though running the statement directly works perfectly (successfully deleting {project-name}:my_data.sample_model), the validation failure blocks scheduling the query with the message "Cannot schedule invalid queries".
Update (March 25, 2021)
This bug has been fixed and is no longer present.
Root Cause
This appears to be a bug in the BigQuery UI's validation logic. The validator incorrectly treats the DROP MODEL statement as a model creation/training command that requires training configuration, leading to an irrelevant check for empty training options.
Workarounds
Two reliable workarounds exist to bypass this validation error:
- Wrap the
DROP MODELstatement withEXECUTE IMMEDIATEto avoid the faulty validation check:EXECUTE IMMEDIATE "DROP MODEL IF EXISTS `my_data.sample_model`" - Since BigQuery ML models are treated as specialized table resources, you can use the
DROP TABLEstatement instead:DROP TABLE IF EXISTS `my_data.sample_model`
I've also submitted a ticket about this issue to the Google Issue Tracker.
内容的提问来源于stack exchange,提问作者Nelly Mincheva

