Cloud Intelligence™Cloud Intelligence™

Cloud Intelligence™

Configurer dbt avec Cloud Composer

By Vinay GandhiSep 7, 20202 min read

Cette page est également disponible en English, Deutsch, Español, Italiano, 日本語 et Português.

Cet article propose un guide pas à pas pour configurer dbt dans Google Cloud Composer.

  1. Pour commencer, créons une instance Cloud Composer avec la configuration d'environnement suivante :

2. Installez deux packages Python dans Composer :

airflow-dbt (l'opérateur dbt et le hook dbt)

dbt (le package Python dbt)

3. Configurez ensuite une variable d'environnement DBT_PROFILES_DIR pointant vers le fichier de clé du compte de service, avec la valeur /home/airflow/gcs/data/profiles.

4. Créez ensuite un compte de service dbt-big-query-user avec le rôle BigQuery User.

Hypothèse : transformation d'un dataset BigQuery vers une autre table BigQuery.

5. Créez un workflow dbt simple à partir de fichiers, en vous appuyant sur les données publiques Jaffle Shop :

6. Définissez le workflow avec l'opérateur dbt (dbtflow.py).

7. Importez les fichiers dans le bucket Composer en respectant la hiérarchie suivante :

8. Déclenchez le DAG dbt dans Composer.

9. Consultez les résultats d'exécution du workflow dbt dans BigQuery.

Références

Téléchargez les fichiers d'exemple décrits ci-dessus depuis : https://bit.ly/3kJ4pWQ sous le nom composer-dbt.zip

composer-dbt.zip \ \ bit.ly

airflow-dbt \ \ This is a collection of Airflow operators to provide easy integration with dbt. Install from PyPI: pip install…\ \ pypi.org

dbt CLI: Create a project | dbt - Documentation \ \ Now that we've successfully run our sample query in BigQuery, and chosen the way we want to develop, we can create a…\ \ docs.getdbt.com

fishtown-analytics/jaffle_shop \ \ jaffle_shop is a fictional ecommerce store. This dbt project transforms raw data from an app database into a customers…\ \ github.com

Schedule dbt models with Apache Airflow | Analytics Mayhem \ \ Working with dbt certainly makes the life of an analyst much better. It brings a certain structure that without a…\ \ analyticsmayhem.com