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.
@@ -526,6 +528,12 @@ def report(
526528 default = None ,
527529 help = "The name of the S3 bucket to upload the report to." ,
528530)
531+ @click .option (
532+ "--s3-acl" ,
533+ type = str ,
534+ default = None ,
535+ help = "S3 Canned ACL value used to modify report permissions, for example set to 'public-read' to make the report publicly accessible." ,
536+ )
529537@click .option (
530538 "--google-service-account-path" ,
531539 type = str ,
@@ -638,6 +646,7 @@ def send_report(
638646 aws_session_token ,
639647 s3_endpoint_url ,
640648 s3_bucket_name ,
649+ s3_acl ,
641650 azure_connection_string ,
642651 azure_container_name ,
643652 google_service_account_path ,
@@ -686,6 +695,7 @@ def send_report(
686695 azure_container_name = azure_container_name ,
687696 s3_endpoint_url = s3_endpoint_url ,
688697 s3_bucket_name = s3_bucket_name ,
698+ s3_acl = s3_acl ,
689699 google_service_account_path = google_service_account_path ,
690700 google_project_name = google_project_name ,
691701 gcs_bucket_name = gcs_bucket_name ,
@@ -766,5 +776,25 @@ def debug(ctx, profiles_dir):
766776 anonymous_tracking .track_cli_end (Command .DEBUG , None , ctx .command .name )
767777
768778
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+
769799if __name__ == "__main__" :
770800 monitor ()
0 commit comments