Add file attachments within a custom scenario (Python) script

S_V84
S_V84 Registered Posts: 2 ✭✭✭✭
edited July 18 in Using Dataiku

Hello,

I am trying to automate a flow using a custom scenario script written in Python. I wish to send one of the outputs produced by the flow as an email attachment once the flow completes. I got this far:


sender = scenario.get_message_sender(channel_id="email_channel_id")

sender.set_params(sender="donotreply@company.com", recipient="someone@company.com")

Not sure how to include attachments in the set_params() call.

Please note that:

  • The attachment is a file within a managed DataIku folder that is expected to be built at the end of the flow
  • It is a multi-worksheet Excel file

Thank you in advance for your help.

Answers

  • madhu310
    madhu310 Registered Posts: 1

    Hi All,
    I wanted to send an attachment using custom python script based on a condition.

    Lets say if my dataset is empty then I do not want to include attachment else include it.

    Can anyone please help me here how to get that done?

Setup Info
    Tags
      Help me…