Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No Columns to parse from file #88

Open
hershey024 opened this issue Jul 8, 2022 · 2 comments
Open

Error: No Columns to parse from file #88

hershey024 opened this issue Jul 8, 2022 · 2 comments

Comments

@hershey024
Copy link

from tableau_api_lib import TableauServerConnection
from tableau_api_lib.utils import querying, flatten_dict_column
import pandas as pd
from sqlalchemy import create_engine
import urllib
import io

Login through U/P, not using token

tableau_server_config = {
'tableau_dev' : {
'server': '',
'api_version': '3.14',
'username':'',
'password':'',
'site_name': '',
'site_url': ''
}
}

Date_filter = urllib.parse.quote('Ext Date')
Month_filter = urllib.parse.quote('Relevant Month')
Code = urllib.parse.quote('Area Code')

conn = TableauServerConnection(config_json = tableau_server_config, env = 'tableau_dev', ssl_verify = False)
response = conn.sign_in()

response

Ext_Date = urllib.parse.quote("2022-07-04")
Relevant_Month = urllib.parse.quote("2022-06-01")
Area_Code = urllib.parse.quote("IND")

param_dict = { "Ext Date": f"vf_{Date_filter}={Ext_Date}",
"Relevant Month": f"vf_{Month_filter}={Relevant_Month}"},
"Area Code": f"vf_{Code}={Area_Code}" }

views_df = querying.get_views_dataframe(conn)
view_df = flatten_dict_column(views_df, keys = ["name", "id"], col_name="workbook")
views_df.head(10)

views_df = views_df[views_df["workbook_name"] == "Month Results"]
views_df_new = views_df[views_df["viewUrlName"] == "Results"]

views_df.head(10)

VIEW_ID = "6v2q12-baa4-3436-v2ws-aswdtgfcqagh"

views_name_df = querying.get_view_data_dataframe(conn, view_id=VIEW_ID, parameter_dict=param_dict)

views_name_df.head(10)

db_connect = create_engine('mqsql+mysqlconnector://----')

IMG_20220708_143523
IMG_20220708_143429

@hershey024 hershey024 changed the title Error: Error: No Columns to parse from file Jul 8, 2022
@divinorum-webb
Copy link
Owner

Hey @hershey024 I'm able to reproduce your results if I create a parameter_dict which defines filters that result in 0 data.

image

In my screenshot I'm doing this by setting an actual field to be filtered by a value which does not exist, which results in 0 results. Also in my screenshot is an example of a successful attempt, where the filters were performed on valid field/values and the result set returned actual data.

This suggests to me that your combination of filters may have at least one incorrect value. When a filter name is incorrect, the API ignores that filter attempt (no harm done). But if your filter name is correct and the values are not correct, this leads to a problem because the API passes the incorrect values through under the real filter field and no matching data is found.

My first guess would be that the area code might be incorrect. Is it possible you have aliased your area codes in Tableau? For example, I typically would see area codes like 303 in my own experience. Perhaps there is some aliasing in Tableau that maps 303 to XYZ. If indeed the IND area code maps to a number or some other value, then use the underlying "true" value rather than the alias. As for your dates, those seem fine. Still, it might be work saving your workbook as a .twb file and then opening it in a text editor to see how your dates are stored and how various values appear in the workbook.

Here is a screenshot of my .twb file opened in a text editor, where I've found how my dates are represented. In my case the appropriate way to specify my date filters would be in the yyyy-mm-dd format (same as you have done) even though they render in the visuals as yyyy/mm/dd. Ignore the # symbol that wraps the value.
image

Hope that helps!

@hershey024
Copy link
Author

Hi @divinorum-webb, thanks for your help. I checked and changed the area code value and the filter is working fine, but the date filter is still throwing EmptyDataError. I entered the date in yyyy-mm-dd format. Also checked the underlying query to verify the original column name(changing to it) but with no luck. .twb file also displays the format in the same way above. Any further suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants