2
votes

I am developing an ETL tool in python. The code generates some data which is then stored in MySQL database. I want to view this data in Tableau (or for that matter any BI visualization tool). For that I have to manually drag and drop the tables into workbook and specify join conditions.

My current workbook looks like this.
Now as the number of tables increases this task becomes cumbersome to do manually. Is it possible to tell the names of the tables and join conditions programmatically. The construction of the sheet/graphs can be done manually. Only the table specification is to be automated since its hectic and error prone.

My research:

  1. I came across an option Convert to custom SQL in which gives the following output. This is the exact thing I want to tell tableau. But there is no import option of such format.

    SELECT
    ship_line.ship_lineid AS ship_lineid,
    ship_line.name AS name,
    ship_line.product_dcid AS product_dcid,
    ship_line.shipmentid AS shipmentid,
    ship_line.sl_act_gi_dte AS sl_act_gi_dte,
    ...
    ...
    FROM ship_line
    INNER JOIN product_dc ON (ship_line._product_dcid = product_dc._product_dcid)
    INNER JOIN shipment ON (ship_line._shipmentid = shipment._shipmentid)
    INNER JOIN ship_to ON (shipment._ship_toid = ship_to._ship_toid)
    INNER JOIN ship_from ON (shipment._ship_fromid = ship_from._ship_fromid)
    INNER JOIN dc ON (shipment._dcid = dc._dcid)
    INNER JOIN carrier ON (shipment._carrierid = carrier._carrierid)
    INNER JOIN product ON (product_dc._productid = product._productid)
    INNER JOIN opco ON (product._opcoid = opco._opcoid)
    INNER JOIN key_customer ON (ship_to._key_customerid = key_customer._key_customerid)

  2. We can export the workbook to .twb or .twbx file. This file contains all the information regarding the workbook. The .twb file is human readable. I can look into creating this file by a script and import it to view the workbook. But I don't really understand the semantics of tags used in it. Is there any documentation for this format.

Can someone provide a way to do this or suggest some other BI/visualization tool that can achieve this.

1
I think you are in "Not supported/recommended by Tableau" territory here. I don't think you will get documentation on tags used in Tableau's workbook. I would recommend using a 'published' data source on tableau server, which has all the tables and join conditions updated manually. All your workbooks can simply used this data-source. Any changes for new tables/joins then would have to be done only at a single place (the data source) instead of all the individual workbook.merawalaid

1 Answers

0
votes

Look into the tableau data extract API. Might be called the tableau SDK now.

Best approach is generate a tableau data extract (tdx file) programmatically and connect your hand constructed workbook (twb file) to it. Then when you regenerate the extract, your workbook automatically sees the changes