- add missing licenses - fix CI setting to run rat plugin - fix deploy script to include integ test modules
Testing dbt project: hudi_examples_dbt
This dbt project transforms demonstrates hudi integration with dbt, it has a few models to demonstrate the different ways in which you can create hudi datasets using dbt.
What is this repo?
What this repo is:
- A self-contained playground dbt project, useful for testing out scripts, and communicating some of the core dbt concepts.
Running this project
To get up and running with this project:
-
Install dbt using these instructions.
-
Install dbt-spark package:
pip install dbt-spark
- Clone this repo and change into the
hudi-examples-dbtdirectory from the command line:
cd hudi-examples/hudi-examples-dbt
- Set up a profile called
sparkto connect to a spark cluster by following these instructions. If you have access to a data warehouse, you can use those credentials – we recommend setting your target schema to be a new schema (dbt will create the schema for you, as long as you have the right privileges). If you don't have access to an existing data warehouse, you can also setup a local postgres database and connect to it in your profile.
NOTE: You need to include the hudi spark bundle to the spark cluster, the latest supported version is 0.10.1.
- Ensure your profile is setup correctly from the command line:
dbt debug
Output of the above command should show this text at the end of the output:
All checks passed!
- Run the models:
dbt run
Output should look like this:
05:47:28 Running with dbt=1.0.0
05:47:28 Found 5 models, 10 tests, 0 snapshots, 0 analyses, 0 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics
05:47:28
05:47:29 Concurrency: 1 threads (target='local')
05:47:29
05:47:29 1 of 5 START incremental model analytics.hudi_insert_table...................... [RUN]
05:47:31 1 of 5 OK created incremental model analytics.hudi_insert_table................. [OK in 2.61s]
05:47:31 2 of 5 START incremental model analytics.hudi_insert_overwrite_table............ [RUN]
05:47:34 2 of 5 OK created incremental model analytics.hudi_insert_overwrite_table....... [OK in 3.19s]
05:47:34 3 of 5 START incremental model analytics.hudi_upsert_table...................... [RUN]
05:47:37 3 of 5 OK created incremental model analytics.hudi_upsert_table................. [OK in 2.68s]
05:47:37 4 of 5 START incremental model analytics.hudi_upsert_partitioned_cow_table...... [RUN]
05:47:40 4 of 5 OK created incremental model analytics.hudi_upsert_partitioned_cow_table. [OK in 2.60s]
05:47:40 5 of 5 START incremental model analytics.hudi_upsert_partitioned_mor_table...... [RUN]
05:47:42 5 of 5 OK created incremental model analytics.hudi_upsert_partitioned_mor_table. [OK in 2.53s]
05:47:42
05:47:42 Finished running 5 incremental models in 14.70s.
05:47:42
05:47:42 Completed successfully
- Test the output of the models:
dbt test
Output should look like this:
05:48:17 Running with dbt=1.0.0
05:48:17 Found 5 models, 10 tests, 0 snapshots, 0 analyses, 0 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 0 metrics
05:48:17
05:48:19 Concurrency: 1 threads (target='local')
05:48:19
05:48:19 1 of 10 START test not_null_hudi_insert_overwrite_table_id...................... [RUN]
05:48:19 1 of 10 PASS not_null_hudi_insert_overwrite_table_id............................ [PASS in 0.50s]
05:48:19 2 of 10 START test not_null_hudi_insert_overwrite_table_name.................... [RUN]
05:48:20 2 of 10 PASS not_null_hudi_insert_overwrite_table_name.......................... [PASS in 0.45s]
05:48:20 3 of 10 START test not_null_hudi_insert_overwrite_table_ts...................... [RUN]
05:48:20 3 of 10 PASS not_null_hudi_insert_overwrite_table_ts............................ [PASS in 0.47s]
05:48:20 4 of 10 START test not_null_hudi_insert_table_id................................ [RUN]
05:48:20 4 of 10 PASS not_null_hudi_insert_table_id...................................... [PASS in 0.44s]
05:48:20 5 of 10 START test not_null_hudi_upsert_table_id................................ [RUN]
05:48:21 5 of 10 PASS not_null_hudi_upsert_table_id...................................... [PASS in 0.38s]
05:48:21 6 of 10 START test not_null_hudi_upsert_table_name.............................. [RUN]
05:48:21 6 of 10 PASS not_null_hudi_upsert_table_name.................................... [PASS in 0.40s]
05:48:21 7 of 10 START test not_null_hudi_upsert_table_ts................................ [RUN]
05:48:22 7 of 10 PASS not_null_hudi_upsert_table_ts...................................... [PASS in 0.38s]
05:48:22 8 of 10 START test unique_hudi_insert_overwrite_table_id........................ [RUN]
05:48:23 8 of 10 PASS unique_hudi_insert_overwrite_table_id.............................. [PASS in 1.32s]
05:48:23 9 of 10 START test unique_hudi_insert_table_id.................................. [RUN]
05:48:24 9 of 10 PASS unique_hudi_insert_table_id........................................ [PASS in 1.26s]
05:48:24 10 of 10 START test unique_hudi_upsert_table_id................................. [RUN]
05:48:25 10 of 10 PASS unique_hudi_upsert_table_id....................................... [PASS in 1.29s]
05:48:26
05:48:26 Finished running 10 tests in 8.23s.
05:48:26
05:48:26 Completed successfully
05:48:26
05:48:26 Done. PASS=10 WARN=0 ERROR=0 SKIP=0 TOTAL=10
- Generate documentation for the project:
dbt docs generate
- View the documentation for the project after running the following command:
dbt docs serve
For more information on dbt:
- Read the introduction to dbt.
- Read the dbt viewpoint.
- Join the dbt community.