Replies: 1 comment 1 reply
-
Unfortunately, this is going to be a limitation on the Tableau Prep side rather than TabPy, since Prep is what requires knowledge of the Schema. I'd suggest submitting this as a feature request for Prep and potentially exploring using Table Extensions in Desktop/Web Authoring as a way to access the data dynamically using Python. This will likely be a major change in Prep though, so the advice they will likely give is to work on using the MongoDB connector. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem Statement : Currently, Tableau Prep Script does not support passing args, also no args can be passed to get_output_schema function
I have 1 generic python function inside script that sends different kinds of pandas dataframe based on input args.
get_collection_data(mongodb collection name, db_name)
I figured out a way to create dynamic number of functions based on how many collections are in mongoDB.
Looping over all collections available and coll<collectionName> = lambda x : get_collection_data()
But, I could not get a work around with get_output_schema function. I am able to generate schema for different collections pd.DataFrame({"dynamic schema based on collection name"}), But could not change get_output_schema function behaviour dynamically on Run-Time.
I tried with exec(), eval().. But No luck.
This could be solved if I can pass _args to the both function call (get_collection_data and get_output_schema)
Right now due to this limitation, I have to manage multiple .py files with almost 98% same code. Only the get_output_schema function is different.
Can anyone please suggest a better way to do this ?
Note : I tried to use MongoDB BI Connector, It has a lot more complexity. I find this way much easier.
Beta Was this translation helpful? Give feedback.
All reactions