1111)
1212from elementary .monitor .data_monitoring .schema import FiltersSchema
1313from elementary .monitor .data_monitoring .selector_filter import SelectorFilter
14+ from elementary .monitor .dbt_init import DBTInit
1415from elementary .monitor .debug import Debug
1516from elementary .tracking .anonymous_tracking import AnonymousCommandLineTracking
1617from elementary .utils import bucket_path
@@ -24,6 +25,7 @@ class Command:
2425 REPORT = "monitor-report"
2526 SEND_REPORT = "monitor-send-report"
2627 DEBUG = "debug"
28+ DBT_INIT = "dbt-init"
2729
2830
2931# Displayed in reverse order in --help.
@@ -774,5 +776,25 @@ def debug(ctx, profiles_dir):
774776 anonymous_tracking .track_cli_end (Command .DEBUG , None , ctx .command .name )
775777
776778
779+ @monitor .command ()
780+ @click .pass_context
781+ def dbt_init (ctx ):
782+ """
783+ Initializes the Elementary internal dbt project by installing its dbt deps.
784+ Run this command after installing EDR as part of builds or CI/CD pipelines when the target
785+ environment does not have write permissions on disk or does not have internet connection.
786+ This command is not needed in most cases as the dbt deps are installed automatically when running `edr monitor`.
787+ """
788+ config = Config ()
789+ anonymous_tracking = AnonymousCommandLineTracking (config )
790+ anonymous_tracking .track_cli_start (Command .DEBUG , None , ctx .command .name )
791+ dbtinit = DBTInit ()
792+ success = dbtinit .setup_internal_dbt_packages ()
793+ if not success :
794+ sys .exit (1 )
795+ click .echo ("Elementary internal dbt project has been initialized successfully. " )
796+ anonymous_tracking .track_cli_end (Command .DEBUG , None , ctx .command .name )
797+
798+
777799if __name__ == "__main__" :
778800 monitor ()
0 commit comments