This lab walks you through the process to create and execute a SQL workflow in Dataform to load data in BigQuery.
Learning objectives
Create a Dataform repository.
Create and initialize a Dataform development workspace.
Create and execute a SQL workflow.
View execution logs in Dataform.
Setup
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Qwiklabs using an incognito window.
Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Task 1. Create a Dataform repository
In the Console, expand the Navigation menu, then select BigQuery > Dataform.
Click CREATE REPOSITORY.
On the Create repository page, do the following:
In the Repository ID field, enter quickstart-repository.
In the Region list, select .
Click CREATE.
Once the repository is created, you will see the Dataform service account. Please copy this down, so you can use it later to assign necessary permissions.
Click Go to Repositories.
Note: If you get permission denied error related to API request wait for few minutes and create the repository again.
Test completed task
Click Check my progress to verify the objective.
Create a Dataform repository.
Task 2. Create and initialize a Dataform development workspace
On the Dataform page, click on the quickstart-repository repository you just created.
Click CREATE DEVELOPMENT WORKSPACE.
In the Create development workspace window, do the following:
In the Workspace ID field, enter quickstart-workspace.
Click CREATE.
Once created, click on the quickstart-workspace development workspace.
Click INITIALIZE WORKSPACE.
Test completed task
Click Check my progress to verify the objective.
Create a Dataform workspace.
Task 3. Create a SQLX file for defining a view
In this section, you define a view that you will later use as a data
source for a table.
In the Files pane, next to definitions, click the More menu.
Click Create file.
In the Create new file pane, do the following:
In the Add a file path field, enter
definitions/quickstart-source.sqlx.
Click CREATE FILE.
Define a view
In the Files pane, expand the definitions folder.
Click quickstart-source.sqlx.
In the file, enter the following code snippet:
config {
type: "view"
}
SELECT
"apples" AS fruit,
2 AS count
UNION ALL
SELECT
"oranges" AS fruit,
5 AS count
UNION ALL
SELECT
"pears" AS fruit,
1 AS count
UNION ALL
SELECT
"bananas" AS fruit,
0 AS count
Task 4. Create a SQLX file for table definition
In the following sections, you define the table type in a SQLX file, and then
write a SELECT statement to define the table structure within the same file.
In the Files pane, next to definitions, click the More menu, and then select Create file.
In the Add a file path field, enter definitions/quickstart-table.sqlx.
Click CREATE FILE.
Define the table type, structure and dependencies
In the Files pane, expand the definitions directory.
Select quickstart-table.sqlx, and then enter the following table
type and SELECT statement:
config {
type: "table"
}
SELECT
fruit,
SUM(count) as count
FROM ${ref("quickstart-source")}
GROUP BY 1
Note: You might notice an error note in the compiled queries section. Ignore the message and proceed to further steps to execute the workflow.
Task 5. Grant Dataform access to BigQuery
In the Google Cloud console, on the Navigation menu (), select IAM & Admin > IAM.
Click VIEW BY PRINCIPALS. Next, click GRANT ACCESS
In the New principals field, enter your Dataform
service account ID.
In the Select a role drop-down list, select the BigQuery Job User role.
Click Add another role, and then in the Select a role drop-down list,
select the BigQuery Data Editor role.
Click Add another role, and then in the Select a role drop-down list,
select the BigQuery Data Viewer role.
Click Save.
Test completed task
Click Check my progress to verify the objective.
Grant Dataform access to BigQuery.
Task 6. Execute the workflow
In the Console, go to Navigation Menu > BigQuery > Dataform.
Click on quickstart-repository to open the repository.
Click on quickstart-workspace to open the development workspace.
On the quickstart-workspace page, click START EXECUTION.
Click Execute actions.
Click All actions tab.
In the Execute pane, click START EXECUTION.
Dataform uses the default repository settings to create the
contents of your workflow in a BigQuery dataset called dataform.
Test completed task
Click Check my progress to verify the objective.
Create and execute the SQL workflow.
View execution logs
On the quickstart-workspace page, click EXECUTIONS to open the Executions pane.
To view details of your execution, click the latest execution.
End your lab
When you have completed your lab, click End Lab. Qwiklabs removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
1 star = Very dissatisfied
2 stars = Dissatisfied
3 stars = Neutral
4 stars = Satisfied
5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Moduły tworzą projekt Google Cloud i zasoby na określony czas.
Moduły mają ograniczenie czasowe i nie mają funkcji wstrzymywania. Jeśli zakończysz moduł, musisz go zacząć od początku.
Aby rozpocząć, w lewym górnym rogu ekranu kliknij Rozpocznij moduł.
Użyj przeglądania prywatnego
Skopiuj podaną nazwę użytkownika i hasło do modułu.
Kliknij Otwórz konsolę w trybie prywatnym.
Zaloguj się w konsoli
Zaloguj się z użyciem danych logowania do modułu. Użycie innych danych logowania może spowodować błędy lub naliczanie opłat.
Zaakceptuj warunki i pomiń stronę zasobów przywracania.
Nie klikaj Zakończ moduł, chyba że właśnie został przez Ciebie zakończony lub chcesz go uruchomić ponownie, ponieważ spowoduje to usunięcie wyników i projektu.
Ta treść jest obecnie niedostępna
Kiedy dostępność się zmieni, wyślemy Ci e-maila z powiadomieniem
Świetnie
Kiedy dostępność się zmieni, skontaktujemy się z Tobą e-mailem
Jeden moduł, a potem drugi
Potwierdź, aby zakończyć wszystkie istniejące moduły i rozpocząć ten
Aby uruchomić moduł, użyj przeglądania prywatnego
Uruchom ten moduł w oknie incognito lub przeglądania prywatnego. Dzięki temu unikniesz konfliktu między swoim kontem osobistym a kontem do nauki, co mogłoby spowodować naliczanie dodatkowych opłat na koncie osobistym.
This lab walks you through the process to create and execute a SQL workflow in Dataform to load data in BigQuery.
Czas trwania:
Konfiguracja: 0 min
·
Dostęp na 60 min
·
Ukończono w 60 min