tableau / TabPy

Execute Python code on the fly and display results in Tableau visualizations:
https://tableau.github.io/TabPy/
MIT License
1.55k stars 592 forks source link

Script returns no data when output columns differ from input #436

Closed w0otness closed 4 years ago

w0otness commented 4 years ago

Environment information:

Describe the issue Script returns no data when columns differ from input

To Reproduce In Tableau Prep, when connected to a CSV containing just a header and one blank row:

id

and attaching this script:

def testing(inputs):
  return pd.DataFrame([{'id2':"a"},{'id2':"b"}])

def get_output_schema():
  return pd.DataFrame({'id2':['prep_string_type']})

Prep show no rows and displays Error: The script didn't return any results. TabPy Log shows no errors.

Expected behavior Prep should display 2 rows with 'a' and 'b' in a column 'id2'

0golovatyi commented 4 years ago

@w0otness For Tableau Prep specific questions I recommend asking those at https://community.tableau.com/s/topic/0TO4T000000QF9rWAG/tableau-prep.

w0otness commented 4 years ago

Ok fixed it myself, The csv needs to have at least one row:

id
null

Then the expected behaviour of new columns and rows happens.

peterg66 commented 1 year ago

Thanks, very useful because the error message is not very explanatory