26 Apr 19 · Mike-Barn · #bigquery ·   Bookmark   ×

Solved: Biquery CLI error in query string Unrecognized name - when using single quotes in IN CLAUSE

Problem:

When running a query with an IN CLAUSE from the CLI, Bigquery throws the below error message:

Example:

bq query --use_legacy_sql=false 'SELECT * FROM `project.datset.table` WHERE weekday_name_abbreviated IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri');'
Error in query string: Error processing job : Unrecognized name: Mon at

Solution:

  • Make sure to enclose the SQL Query in Double quotes instead of single quotes
  • Remove the backticks on the project names and instead use a semicolon as shown below
bq query --use_legacy_sql=false "SELECT * FROM project:datset.table WHERE weekday_name_abbreviated IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri');"

Mike-Barn

posted on 26 Apr 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds