Question

Send email with content that has been written to sql table

  • 14 November 2017
  • 2 replies
  • 9 views

Badge

Hi,

I am creating a workbench that executes an sql query (select query) and writes the results to an MS SQL table. I would like to write the contents to an email. I have used the shut down python script before (emailing after workbench has run successfully and writes the number of features written) but I cannot find resources in writing the contents of what has been written to the SQL table. I have four rows and with four fields that gets appended every time the workbench is run.

 

Is there a way to parse these values to the email?

Thank you.


2 replies

Userlevel 6
Badge +32
What version Workbench? I'm no Py expert but the Emailer Transformer should do the job fairly easy? Attachment or HTML.
Badge +2

Try the combination of FeatureWriter and SQLExecutor transformers. these can be used to write to your SQL Server database and then read back the rows you need and append them to an email using the Emailer transformer. There is an example of using FeatureWriter and Emailer in the article Using the FeatureWriter Transformer with your Database (featurewriter-final.fmwt). Not exactly your scenario, but it might give you some ideas.

Reply