-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ff0e1c
commit 6bb1584
Showing
10 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
|
||
|
||
def init_plugins_dbtdocs_page(dbt_docs_dir: Path): | ||
from airflow.plugins_manager import AirflowPlugin | ||
from flask import Blueprint | ||
from flask_appbuilder import BaseView, expose | ||
|
||
class DBTDocsView(BaseView): | ||
# Use it like this if you want to restrict your view to readonly:: | ||
base_permissions = ['can_list', 'can_show'] | ||
default_view = "index" | ||
|
||
@expose("/") | ||
def index(self): | ||
return dbt_docs_dir.joinpath("index.html").read_text() | ||
# return self.render_template("index.html", content="") | ||
|
||
# Creating a flask blueprint to integrate the templates and static folder | ||
bp = Blueprint( | ||
"DBT Docs Plugin", | ||
__name__, | ||
template_folder=dbt_docs_dir.as_posix(), | ||
static_folder=dbt_docs_dir.as_posix(), | ||
static_url_path='/dbtdocsview' | ||
) | ||
|
||
v_header_menu = {"name": "DBT Docs", "category": "", "view": DBTDocsView()} | ||
|
||
class AirflowDbtDocsPlugin(AirflowPlugin): | ||
name = "DBT Docs Plugin" | ||
flask_blueprints = [bp] | ||
appbuilder_views = [v_header_menu] | ||
|
||
return AirflowDbtDocsPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from pathlib import Path | ||
|
||
from opendbt.airflow import dbtdocs | ||
|
||
# create public page on airflow server to serve DBT docs | ||
airflow_dbtdocs_page = dbtdocs.init_plugins_dbtdocs_page(Path("/opt/dbttest/target")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters