3

I am using Bigquery Operator for my Airflow Task. I am passing an Sql query to operator and trying to insert result of BQ query into a BQ table. While doing this, getting below error

google.api_core.exceptions.BadRequest: 400 Result of ORDER BY queries cannot be partitioned by field 'batch_date'

Same SQL query works fine if run on BQ console. Table is partitioned on batch_date so the table name I am passing to BQ operator is table_name$batch_date

This error is coming for BQ insert job.

Any help/clue?

Amol
  • 93
  • 7

1 Answers1

3

Simply remove the ORDER BY clause in the main query and it works

Danny
  • 31
  • 1
  • 1
    Thanks Danny.. It does work without ORDER BY clause. But I need that clause and to my surprise It was working till couple of days back with ORDER BY clause.. started failing since yesterday..Any other alternative which works even with ORDER BY clause? – Amol Apr 06 '22 at 12:36
  • I met the same problem exactly like yours. But for my case as it serves as a raw table for further processing so this solution works for me. – Danny Apr 06 '22 at 12:58
  • Do we know why this error happens? Seems like ORDER BY should be working for a valid field. – Siddarth Krishna S Jul 19 '22 at 08:05