Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use field alias with space in Google Big Query

We need to create descriptive aliases for fields. Ideally we would like to create views with alias with a space. Is this possible? How can we do this?

Example: SELECT word, word_count "Word Count" FROM [publicdata:samples.shakespeare] LIMIT 1000

like image 326
Sudhir Hasbe Avatar asked Mar 08 '15 12:03

Sudhir Hasbe


People also ask

Are BigQuery column names case sensitive?

Google BigQuery is not case sensitive, so all names default to lowercase.

How do you remove spaces in BigQuery?

If no character is specified, whitespaces are removed by default. LTRIM (value1[, value2]): LTRIM Function removes the character specified from the left i.e it only removes the leading characters that match value2. Similar to the TRIM Function if a character is not specified, it removes the whitespaces by default.


1 Answers

No, the rules for field names (and aliases) in BigQuery are quite simple, and I quote:

Fields must contain only letters, numbers, and underscores, start with a letter or underscore, and be at most 128 characters long.

As you see, spaces, quote characters, and other punctuation, are not allowed. Feel free to open a feature request at https://code.google.com/p/google-bigquery/ (explaining your use case, esp. why using underscores in lieu of spaces is not acceptable) -- or star an existing FR at https://code.google.com/p/google-bigquery/issues/list if it coincides with your requirements.

like image 170
Alex Martelli Avatar answered Oct 07 '22 13:10

Alex Martelli