Skip to content

Conversation

@graysonarts
Copy link
Contributor

Clean up the API a bit because I didn't really click with it.

@graysonarts graysonarts requested review from shinchris and t8y8 January 17, 2018 17:15
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.

All nits.

🚀



def main():
parser = argparse.ArgumentParser(description='Get all of the refresh tasks available on a server')
Copy link
Collaborator

Choose a reason for hiding this comment

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

The description is for the wrong sample (I bet a lot of our samples are, actually)

resource = endpoint.get_by_id(args.resource_id)
endpoint.populate_connections(resource)
connections = filter(lambda x: x.id == args.connection_id, resource.connections)
assert(len(connections) == 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you have to list(filter Here for python3? I forget if filter_results objects have len

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh. Yes.

return self._connection_type

def __repr__(self):
return "<ConnectionItem#{_id} embed={embed_password} type={_connection_type} username={username}>"\
Copy link
Collaborator

Choose a reason for hiding this comment

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

One day we can use f-strings. One day...

# Update workbook_connection
def update_conn(self, workbook_item, connection_item):
@api(version="2.3")
def update_connection(self, workbook_item, connection_item):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should probably set update_conn to update_connection for back compact; and throw a warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably... I'll make the change.

@t8y8
Copy link
Collaborator

t8y8 commented Jan 17, 2018

I like it!

We may want to let the guy who was working on adding multiple connections know (did that ever get done? I should pester Ben...)

@graysonarts graysonarts merged commit a1179eb into tableau:development Jan 17, 2018
@graysonarts graysonarts deleted the 190-add-update-datasource-connection branch January 17, 2018 18:50
@bheem123
Copy link

I tested the update_connection.py on my server version 2018.2, and it does not work. No error, but nothing is updated on server. Did this work for anyone?

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.

4 participants