0 votes
1 view
in BI by (13.4k points)

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 it's 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 Answer

0 votes
by (36.7k points)

  • You need to check into the tableau data extract API  as Tableau SDK might be called.

  • Better approach is to generate a tableau data extract (tdx file) programmatically and connect your hand constructed workbook (twb file) to it. And then regenerate the extract so that your workbook automatically sees the changes

...