Тёмный
No video :(

BigQuery Variables 👴🏼 

Mr. Rohbot
Подписаться 240
Просмотров 3,1 тыс.
50% 1

Опубликовано:

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7   
@alainponroy2621
@alainponroy2621 3 месяца назад
super interesting video 🙂
@alsonyang230
@alsonyang230 Год назад
Great videos and thanks for the content! Is there a proper offical way to distinguish between a variable and a column name at use? Like you would @ to singal this is a parameter. the underscore prefix to me is a patch solution that will works 99.99% of the times until some crazy people start to write column name with underscore prefix and break it accidentally😂
@rohbot
@rohbot Год назад
Hey Alson, thanks for the kind message and your question. You are absolutely right, I can see this happening as well :-D The documentation does not state any prefix that you could use to adress the variable, however all system variables from bigquery are adressed with a @@ (cloud.google.com/bigquery/docs/reference/system-variables). The catch on this is that you cannot define a column name with an @ inside (cloud.google.com/bigquery/docs/schemas#column_names), however you can define a variable having an @ inside and reference it just fine. In one of the examples in the video I could define the variable platform as follows: DECLARE `@platform` STRING DEFAULT 'ANDROID'; SELECT * FROM dwh_main.traffic WHERE platform = `@platform` -- works fine Referencing the variable without renaming it in the select statement would not work SELECT `@platform`, -- throws an error `@platform` as platform -- does not throw error FROM dwh_main.traffic WHERE platform = `@platform` -- works fine With this you can be sure that you will not have a column that is matching your variable :-) Let me know if that helped with 0.01% Martin
@alsonyang230
@alsonyang230 Год назад
@@rohbot Hey Martin, thanks for your response. This makes sense and would work great i think. really appreciate that!
@meena_deb3795
@meena_deb3795 Год назад
Does the declared Variable remains the same inside the whole script once we have declared? Or do we need to declare them before each and every create or select in case we want to reuse the same declared variable inside the script multiple times in different places?
@rohbot
@rohbot Год назад
Hey Meena_Deb, Great question! Yes you would only need to declare them once and be able to use them multiple times in your script. If you are in session mode, then you just need to execute the variable declaration once, but in the "normal" mode you always need to execute the variable declaration as well when running your query. Let me know if I that was helpful :-) Stay Great Martin
@meena_deb3795
@meena_deb3795 Год назад
@@rohbot that's great, thank you
Далее
Loops in BigQuery: Recursive Joins
9:33
Просмотров 3,1 тыс.
C’est qui le plus fort 😂
00:18
Просмотров 6 млн
Pivot Tables in BigQuery SQL🤓
8:30
Просмотров 3,9 тыс.
Google PageSpeed API with Python
10:02
Просмотров 1,5 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 354 тыс.
Connect Google Sheets & BigQuery - Connected Sheets
14:24
BigQuery Analytic Function and ROW_NUMBER()
18:44
Просмотров 1,1 тыс.
Google BigQuery Top 5 Must Know Functions
12:14
Просмотров 1 тыс.