Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement view filters on the populate* request options#260

Merged
graysonarts merged 6 commits intotableau:developmenttableau/server-client-python:developmentfrom
graysonarts:add-view-filters-to-exportsCopy head branch name to clipboard
Jan 31, 2018
Merged

Implement view filters on the populate* request options#260
graysonarts merged 6 commits intotableau:developmenttableau/server-client-python:developmentfrom
graysonarts:add-view-filters-to-exportsCopy head branch name to clipboard

Conversation

@graysonarts
Copy link
Contributor

This is fallout from a bug I was fixing elsewhere, but we should have them.

@graysonarts graysonarts requested review from LGraber and t8y8 January 30, 2018 22:32
def _get_view_csv(self, view_item, req_options):
url = "{0}/{1}/data".format(self.baseurl, view_item.id)

with closing(self.get_request(url, parameters={"stream": True})) as server_response:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right, the 'stream=true' is an option for the requests library, not something that gets included in the url string, which is what apply_query_parameters does.

t8y8
t8y8 previously approved these changes Jan 31, 2018
Copy link
Collaborator

@t8y8 t8y8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fit-It-Then-:rocket:

All minor

url = "{0}/{1}/data".format(self.baseurl, view_item.id)

with closing(self.get_request(url, parameters={"stream": True})) as server_response:
with closing(self.get_request(url, req_options, {"stream": True})) as server_response:
Copy link
Collaborator

@t8y8 t8y8 Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This might already by correct, but since I'm not 100% sure the order of function parameters as they get passed to the underlying requests.get, can you make the {"stream":True} a named parameter ( parameters=...)

Ugh, naming a parameter parameters is confusing. Thanks Requests....



class ImageRequestOptions(RequestOptionsBase):
class _FilterOptionsBase(RequestOptionsBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable refactor.

Can you give this class a docstring just so at a glance we can tell what it's used for vs other optionsbases?

class ImageRequestOptions(RequestOptionsBase):
class _FilterOptionsBase(RequestOptionsBase):
def __init__(self):
self.view_filters = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling it view filters and then using it in CSV options is a little confusing to me -- can you tell me your thinking on this vs just 'filters'?

I'm not opposed just want to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have filters which is for filtering responses to the "get" calls. View Filters are different because they are filtering the view. A CSV is still a view of the data...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are filtering literal Views (Vizzes?) Ok that makes sense.

class Resolution:
High = 'high'

def __init__(self, imageresolution=None):
Copy link
Collaborator

@t8y8 t8y8 Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: I thought I made this so it was image_resolution... maybe I never checked that fix in?

I might make a PR after this merges

def apply_query_params(self, url):
raise NotImplementedError()

def vf(self, name, value):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no code testing this or sampling this yet, but I'm guessing this makes it:

opts = ImageRequestOptions()
opts.vf('a', 1).vf('b', 2) etc?

Baby-builder pattern!
Did you still want to refactor this all to eventually just be builder-y and call str on those? (referenced in #212)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, eventually, we will refactor to a builder pattern!

Copy link
Collaborator

@t8y8 t8y8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@graysonarts graysonarts changed the base branch from master to development January 31, 2018 22:24
@graysonarts graysonarts merged commit 7816d2e into tableau:development Jan 31, 2018
@graysonarts graysonarts deleted the add-view-filters-to-exports branch January 31, 2018 22:24
@lpm-lpm
Copy link

lpm-lpm commented Jun 12, 2018

Hi @RussTheAerialist

Any ETA of this getting merged to master branch?

@ecmonsen
Copy link

Thank you for adding view filters - I needed it for requesting view images. Looking forward to seeing it merged into the master branch.

@mcoles
Copy link

mcoles commented Jul 13, 2018

Ditto, this is important for me as well!

@graysonarts
Copy link
Contributor Author

We released v0.7 on Wednesday which contains these changes.

@xevo-emonsen
Copy link

You rock, @RussTheAerialist! Thanks!

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

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.