3 Replies Latest reply on Feb 25, 2020 2:16 AM by Brian Tribondeau

    Question regarding On-demand refresh of data source in Jupytab extension

    Robert Leyba

      Hi team,  

       

        This is regarding a feature of this very good extension   --> https: //community.tableau.com/thread/316214

       

        The use of jupyter notebooks as a WDC data source is really useful, particularly for python users who are already using Jupyter notebooks regularly.   My question is,  if I have a pandas dataframe that gets updated several times during the day, which is the "netobjectspandas"  element that I have below,   when the jupytab invokes this notebook whether via an extract refresh or datasource refresh,   the returning table doesn't show up as updated in my tableau datasource.   I have to run the "Restart kernel" command from the WDC  of Jupytab just so that it initializes the connection again and re-run the notebook and then I do a "refresh all datasources" from Tableau.  Only then does it update.  This is quite inconvenient as I no longer trust the freshness of my data and would need to keep resetting the jupytab utility, just to get the latest extract.

       

        I was under the impression that the "dynamic tables" being referred to in the article by the developer (Brian) would do this,   but looks like I am misunderstanding it's use or there is a step I am missing.

       

       

       

      def dynamic_df():

          return pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=['a', 'b', 'c'])

       

      def dynamic2_df():

          return netobjectspandas   ------------->>> this is already a valid and working Pandas dataframe defined somewhere in my code.

       

      tables = jupytab.Tables()  # Publication-ready tables contained by this notebook

       

      # Example 1: Static data: it will never change on the Tableau side:

      static_df = dynamic_df()

      tables['static'] = jupytab.DataFrameTable('A static table', dataframe=static_df)

       

      # Example 2: Dynamic data: a new DataFrame is generated whenever Extract is requested on Tableau's side:

      tables['dynamic'] = jupytab.DataFrameTable('A dynamic table', refresh_method=dynamic_df)

       

      tables['net_object'] = jupytab.DataFrameTable('Network_Objects', refresh_method=dynamic2_df)

       

       

      Does someone in this forum have a similar experience?  Unfortunately, I can't include my workbook as there is too much confidential data in the code.  This is a general question, anyway.

       

      Thank you.