Skip to content

Commit

Permalink
Merge pull request #138 from openedx/cag/custom-dbt-packages
Browse files Browse the repository at this point in the history
feat: allow to install extra dbt packages
  • Loading branch information
Ian2012 authored Jul 5, 2023
2 parents 40d5042 + 4eb28c4 commit 6e720b6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ Available languages are stored in a mapping, and so best edited directly in Tuto

Where the first key is the abbreviation of the language to use, "flag" is which flag icon is displayed in the user interface for choosing the language, and "name" is the displayed name for that language. The mapping above shows all of the current languages supported by Superset, but please note that different languages have different levels of completion and support at this time.


Extending the DBT project
^^^^^^^^^^^^^^^^^^^^^^^^^^

To extend the DBT project there are multiple options:

#. DBT_REPOSITORY: A git repository URL to the DBT project
#. DBT_BRANCH: A git branch to use for the DBT project
#. DBT_REPOSITORY_PATH: A path to the DBT project in the git repository
#. EXTRA_DBT_PACKAGES: A list of python packages necessary for the DBT project
#. DBT_ENABLE_OVERRIDE: A boolean to enable/disable the DBT project override, those overrides
allows you to extend the DBT project without having to fork it. For this to work you need
to create a patch with the name ``dbt-packages`` and ``dbt-project``. We recommend to copy
the default DBT files (``dbt_project.yml`` and ``packages.yml``) and add your changes from
there.

License
-------

Expand Down
1 change: 1 addition & 0 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
("DBT_PROFILE_SYNC_REQUEST_TIMEOUT", "5"),
# Compression block size if compression is enabled, this is the default value
("DBT_PROFILE_COMPRESS_BLOCK_SIZE", "1048576"),
("DBT_ENABLE_OVERRIDE", False),
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ patch("dbt-project") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ patch("dbt-packages") }}
8 changes: 8 additions & 0 deletions tutoraspects/templates/aspects/apps/aspects/scripts/dbt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ git clone -b {{ DBT_BRANCH }} {{ DBT_REPOSITORY }}

cd {{ DBT_REPOSITORY_PATH }} || exit

{% if DBT_ENABLE_OVERRIDE %}
echo /app/aspects/dbt/packages.yml > packages.yml
echo /app/aspects/dbt/dbt_project.yml > dbt_project.yml

cat {{ DBT_REPOSITORY_PATH }}/packages.yml
cat {{ DBT_REPOSITORY_PATH }}/dbt_project.yml
{% endif %}

echo "Installing dbt dependencies"
dbt deps --profiles-dir /app/aspects/dbt/

Expand Down

0 comments on commit 6e720b6

Please sign in to comment.