Skip to content

Sample project filtering#201

Merged
acpana merged 5 commits intotableau:developmentfrom
acpana:sample_project_filtering
Jun 26, 2017
Merged

Sample project filtering#201
acpana merged 5 commits intotableau:developmentfrom
acpana:sample_project_filtering

Conversation

@acpana
Copy link

@acpana acpana commented Jun 20, 2017

No description provided.

TSC.RequestOptions.Operator.Equals,
filter_project_name))

filter_projects_paged = server.projects.get(req_options=options)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will only get the first 100 projects, we should use the next() and TSC.Pager pattern or this will fail on a server with more than 100 projects

Copy link
Contributor

Choose a reason for hiding this comment

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

This is searching for a specific project name. It should only return one or zero.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ooooooh. Yes, that makes sense for project name, we should be careful for things where names aren't unique (User display name comes to mind) but none of the samples touch that yet.

filter_project_name))

filter_projects_paged = server.projects.get(req_options=options)
print(filter_projects_paged[0][0].name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's this trying to do?

Clearer, if possible, is to use tuple unpacking.(Or a comment what this is double indexing into, I can't tell)

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.

Fix, then ship!

🚀


import tableauserverclient as TSC

def create_example_project(_name='Example Project', _content_permissions='LockedToProject',
Copy link
Collaborator

Choose a reason for hiding this comment

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

These shouldn't be prefixed with _

Copy link
Contributor

Choose a reason for hiding this comment

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

agree with @t8y8 here, let's remain these to not have _ in them.

server = TSC.Server(args.server)

with server.auth.sign_in(tableau_auth):
server.version = '2.7'
Copy link
Collaborator

Choose a reason for hiding this comment

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

use_server_version() like the other sample



if __name__ == '__main__':
main() No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there's a whitespace error here, it's hard to tell on github

Copy link
Contributor

Choose a reason for hiding this comment

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

You need a trailing newline at the EOF.
If you run pycodestyle on the file, it'll tell you all the style things that need to be fixed.

Copy link
Contributor

@graysonarts graysonarts left a comment

Choose a reason for hiding this comment

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

Fix the few issues we outlined, and then 🚀



if __name__ == '__main__':
main() No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

You need a trailing newline at the EOF.
If you run pycodestyle on the file, it'll tell you all the style things that need to be fixed.

@t8y8
Copy link
Collaborator

t8y8 commented Jun 23, 2017

🚀

@acpana acpana merged commit aecfe7d into tableau:development Jun 26, 2017
t8y8 pushed a commit to t8y8/server-client-python that referenced this pull request Jun 28, 2017
* Added filtering on project names in new sample script

* Minor comment change

* Clearer unpacking rest api response objects

* Proper printing instructions

* Style changes, removed_, using call to switch server version
t8y8 pushed a commit to t8y8/server-client-python that referenced this pull request Jun 28, 2017
* Added filtering on project names in new sample script

* Minor comment change

* Clearer unpacking rest api response objects

* Proper printing instructions

* Style changes, removed_, using call to switch server version
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.

3 participants