12 Replies Latest reply on Dec 4, 2015 8:04 AM by jegan.sivaraj

    Disable csv in simple alerts

    jegan.sivaraj

      Matt,

       

      I'd like to disable the csv attachment that is sent with the simple alerts. There is way too much data sometimes and it may not be prudent to send them over the exchange server.

       

      I did not see this in the install doc. Is this the set of code that needs to be blocked?

       

              # get the raw csv data from the view

              try:

                  filepath = tabhttp.export_view(configs, view, tabhttp.Format.CSV, logger)

              except Exception as e:

                  errormessage = u'Unable to export viewname {} as {}, error: {}'.format(viewname, tabhttp.Format.CSV, e)

                  logger.error(errormessage)

                  view_failure(view, u'VizAlerts was unable to export data for this view. Error message: {}'.format(errormessage))

                  continue

       

       

              # We now have the CSV, so process it

              try:

                  process_csv(filepath, view, sitename, viewname, subscriberemail, subscribersysname, subscriberdomain,

                              viewurlsuffix, timeout_s)

              except Exception as e:

                  errormessage = u'Unable to process data from viewname {}, error: {}'.format(viewname, e)

                  logger.error(errormessage)

                  view_failure(view, u'VizAlerts was unable to process this view due to the following error: {}'.format(e))

                  continue

      - Jegan

        • 1. Re: Disable csv in simple alerts
          Matt Coles

          Hi Jegan. True, there is no config setting to universally disable the simple alert function of attaching the CSV data. If the concern is just that there's too much data, and just with a few alerts in particular, there are a few approaches you can take that I might recommend first:

           

          1. Further aggregate the data in your viz, or restrict the date range so that less data needs to be visualized

          2. Build an Advanced Alert instead, which will not include the .csv data, but will still enable you to push the image out via email.

           

          If you're concerned about other users beating up your mail server due to CSV size, there is a setting to control the number of rows permitted in it in the config file-- viz.data.maxrows (it defaults to 1000). When this amount is exceeded, the alert will fail.

           

          If none of those options works for you, then you can try editing line 530 (as of this writing) in vizalerts.py by removing "csvpath," from the attachment list, as highlighted below. NOTE that this change hasn't been tested and may break things elsewhere--probably only a 2% chance of that, though.

           

          • 2. Re: Disable csv in simple alerts
            Matt Coles

            Were any of those solutions able to get you what you were after, Jegan?

            • 3. Re: Disable csv in simple alerts
              jegan.sivaraj

              Sorry coudn't get back to you quicker. I removed the csvpath from the attachments in the code. The code still tries to generate the csv though. I was trying to stop it from doing that.

               

              We don't want users distributing data that might have confidential information. One other reason to remove the csv attachments.

              • 4. Re: Disable csv in simple alerts
                Matt Coles

                Hmm, I'm not quite sure what you mean, because I just tested it and it worked for me. The CSV data is always downloaded in order to test whether the alert should be triggered or not, and it's stored locally for as long as you've defined in the config value temp.dir.file_retention_seconds. But that shouldn't be a security concern if you're accessing Tableau Server over https and you've locked down permissions to the host VizAlerts is running on (which should be done anyway, regardless!).


                At any rate, the code change I proposed will prevent the CSV file itself from being attached to the alert email that is sent to the subscriber, leaving just the image. I may be missing something here that you're trying to achieve, though.

                • 5. Re: Disable csv in simple alerts
                  jegan.sivaraj

                  The code change has prevented the csv from bring attached. The attachment was the security concern and that is solved. Thanks for the help.

                   

                  The viz I'm testing with takes a while to generate the csv.There is definitely room for improvement in the viz and I'm starting to look at performance next.

                  • 6. Re: Disable csv in simple alerts
                    Matt Coles

                    Ah, gotcha--thanks for confirming!

                    • 7. Re: Disable csv in simple alerts
                      jegan.sivaraj

                      Follow up question - If just one row is needed to trigger the alert, can the csv be stopped at the first row it brings back?

                      • 8. Re: Disable csv in simple alerts
                        Toby Erkson

                        jegan.sivaraj wrote:

                         

                        Sorry coudn't get back to you quicker. I removed the csvpath from the attachments in the code. The code still tries to generate the csv though. I was trying to stop it from doing that.

                         

                        We don't want users distributing data that might have confidential information. One other reason to remove the csv attachments.

                        So Matt Coles, what about giving Email Action* it's opportunity for a new action type?

                        This field simply indicates that the action for this viz is to send emails (as opposed to other possible action types which may be built...hmmm!).

                        Its default value is 1, meaning the VizAlert will be an Advanced Alert and, currently, it defaults to attaching a .csv file.  How about a value of 2 means the same thing but without an attached .csv file?

                        • 9. Re: Disable csv in simple alerts
                          Matt Coles

                          Jegan--There are several ways to decrease CSV size:

                           

                          1. Restrict the number of rows / columns used in your View on Server.


                          2. Increase the aggregation level of your view on Server.


                          3. Build an alert View that returns as tiny a set of data as possible that you need to define your alert, then embed that View as the "trigger" view in a Dashboard, which shows the more detailed, comprehensive information that is visually helpful. Then, subscribe to the Dashboard itself. You can see an example of this on page 16 of the User Guide. A quick verbal example of this technique would be something like:

                           

                          (in Tableau Desktop)

                          Create sheet "Sales Alert" which shows the sum of Sales for the current quarter, companywide.

                          Create dashboard "Sales Alert Dashboard" which has one Sheet in it which shows the sum of sales for the current quarter, but broken out by individual Sales reps.

                          Rename sheet "Sales Alert" by prepending a dash character to the name, so it is now called "-Sales Alert". This makes it come first alphabetically, which is what ensures it will be the view that generates the CSV.

                          Add the "-Sales Alert" sheet to the "Sales Alert Dashboard" and arrange it however you like.

                          Publish to Server.

                           

                          (On Tableau Server)

                          Subscribe on an Alerts schedule to the "Sales Alert Dashboard"

                           

                          The result is that your alert will be triggered on the total sum of sales for the entire company, resulting in a one-line CSV file, but the actual image will contain the total company sales and the detail of the individual sales amounts for each sales rep. Obviously you may want more criteria in the trigger, but you get the idea--the more you can aggregate the trigger view by keeping it at a high level of detail (less information), the less CSV data you need to deal with.

                          • 10. Re: Disable csv in simple alerts
                            Matt Coles

                            Toby--Advanced Alerts don't currently send any CSV at all, right now (though I do want to add that as a feature). Jegan is using Simple Alerts, which always attach the CSV file, unless you hack the code as shown (I should just add a config value to toggle this behavior, it'd be easy enough).

                            • 11. Re: Disable csv in simple alerts
                              Toby Erkson

                              Well, that just shows how much I have to deal with VA, my bad   It runs so well I don't have to constantly futz with it

                              • 12. Re: Disable csv in simple alerts
                                jegan.sivaraj

                                I'm using an alert view but that uses fairly large blended data sources to calculate the one line for the alert. I will keep working on improving the performance.