runt18 / google-bigquery

Automatically exported from code.google.com/p/google-bigquery
0 stars 0 forks source link

Add "Set Variable" #289

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add the ability to set variables at the top of a script so we dont have to 
manually  change each time the variable appears.-

Original issue reported on code.google.com by cgr...@bauerxcel.com on 28 Jul 2015 at 3:59

GoogleCodeExporter commented 8 years ago
Thanks for the request, I've noted it in our internal tracker.

Original comment by thomasp...@google.com on 24 Nov 2015 at 9:17

GoogleCodeExporter commented 8 years ago
meantime, check 
https://chrome.google.com/webstore/detail/bigquery-mate/nepgdloeceldecnoaaegljli
chnfognh - it has some support for variables (assumed following format  - 
<var_name>
if any other format is used  - there is find and replace feature
not the best way to addres above  - but netter than nothing, till Google team 
make it better for all of us

Original comment by mberly...@vindicotech.com on 13 Dec 2015 at 10:50

GoogleCodeExporter commented 8 years ago
I would like to have this feauture too. Need to set variable to use within 
conditionals (CASE THEN)

Original comment by javier.g...@ingennia.cl on 26 Jan 2016 at 7:34

GoogleCodeExporter commented 8 years ago
Adding variable support (or some type of constant) would be very helpful with 
large queries where the same attribute is used over and over and needs to 
change.

Small example:

@subreddit = "news";

SELECT count(*) c, word FROM (SELECT SPLIT(body, ' ') word FROM (SELECT * FROM 
[rt_reddit.comments@-14400000-]
WHERE LOWER(subreddit) = @subreddit))
GROUP BY word
HAVING word NOT IN (SELECT word FROM (SELECT count(*) c, word FROM (SELECT 
SPLIT(body, ' ') word FROM (SELECT * FROM [rt_reddit.comments@-14400000-] WHERE 
LOWER(subreddit) != @subreddit))
GROUP BY word
ORDER BY c DESC
LIMIT 1000))
ORDER BY c DESC;

Original comment by ja...@pushshift.io on 14 Feb 2016 at 12:09

GoogleCodeExporter commented 8 years ago
Merging into SQL dialect issue.

Original comment by jcon...@google.com on 29 Feb 2016 at 11:58