Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples when creating a Dynamic Table Config #85

Open
JavierArredondo opened this issue Feb 27, 2023 · 0 comments
Open

Improve examples when creating a Dynamic Table Config #85

JavierArredondo opened this issue Feb 27, 2023 · 0 comments

Comments

@JavierArredondo
Copy link

When you create a Dynamic Tag, the documentation shows examples using variables such as $table, $dataset and $project.

The following examples exist:

  • select count(*) from $table;
  • select count(distinct(account_id)) from $table;
  • select count(*) > 1 from $table where account_id is null;
  • select rating from dw-project.quality.scores where table =`$table' and dataset = `$dataset` and project = `$project`;
  • select '30-DAYS';

As you can see, some examples use $table and another uses `$table`, but only the `$table` cases work.

<h5 style="width: 800px;">To include a field in your tag, click on the checkbox next to the field and enter a query expression in the text box. <br>
<br>
The query expression must be a <i>valid</i> select statement in BigQuery. It may contain filter, aggregate functions, joins, groupings, subqueries, etc. as long as it's a valid select statement.<br>
<br>
The query expression may reference these variables:<br>
- <b>$table</b> refers to the BQ table (or view) being tagged<br>
- <b>$dataset</b> refers to the BQ dataset of the table (or view) being tagged<br>
- <b>$project</b> refers to the BQ project of the table (or view) being tagged<br>
<br>
Here are some examples: <br>
&nbsp;select count(*) from $table;<br>
&nbsp;select count(distinct(account_id)) from $table;<br>
&nbsp;select count(*) > 1 from $table where account_id is null;<br>
&nbsp;select rating from dw-project.quality.scores where table = '$table' and dataset = '$dataset' and project = '$project';<br>
&nbsp;select '30-DAYS';<br>
<br>
Note: The result of the query expression must satisfy the type requirements of the field in the tag template. <br>
For example, if the tag template field is of type string, the query expression must return a string type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant