You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes - I'm trying to figure out how this happened, but so far it's a mystery.
I think we want to end up with just the connection_credentials option as a sequence, but I'll take a look to see if there's a way we can temporarily support both inputs.
Looking at it again, workbook endpoint's publish method uses a connections element instead of a connection_credentials element. I think if we leave both inputs there, but just provide a warning, then the function signature can be the same between workbook and datasource.
What I have resorted to doing in my client code is to publishing the datasource, then running update_connection after it was published. Passing only connection_credentials to the datasource publish is technically ambiguous because you can put multiple connection_credentials elements as children to the datasource element. If you have multiple connections to different databases, with the same username but different passwords... How would the API know which credential is supposed to go with which connection?
Circling back to this. I think the best option might be to mirror the workbook.publish endpoint and have it be connections=Sequence[ConnectionItem]. I think that would support the most scenarios and have the benefit of keeping the workbook and datasource endpoints as similar.
The datasource publish signature now mirrors workbook.publish: datasources.publish(..., connection_credentials=None, connections=None, ...) accepts either a single ConnectionCredentials OR a Sequence[ConnectionItem], and passing both raises RuntimeError('You cannot set both connections and connection_credentials') (see tableauserverclient/server/request_factory.pyDatasourceRequest._generate_xml). This matches the recommendation in the last comment on this thread. Closing as completed and removing the in-progress label.
Activity
jacalata commentedon Jun 28, 2022
Yes - I'm trying to figure out how this happened, but so far it's a mystery.
I think we want to end up with just the connection_credentials option as a sequence, but I'll take a look to see if there's a way we can temporarily support both inputs.
jorwoods commentedon Jun 28, 2022
Looking at it again, workbook endpoint's
publishmethod uses a connections element instead of a connection_credentials element. I think if we leave both inputs there, but just provide a warning, then the function signature can be the same between workbook and datasource.What I have resorted to doing in my client code is to publishing the datasource, then running
update_connectionafter it was published. Passing onlyconnection_credentialsto the datasource publish is technically ambiguous because you can put multipleconnection_credentialselements as children to thedatasourceelement. If you have multiple connections to different databases, with the same username but different passwords... How would the API know which credential is supposed to go with which connection?That has me leaning towards option 1, IMO.
jorwoods commentedon Jun 3, 2024
Circling back to this. I think the best option might be to mirror the
workbook.publishendpoint and have it beconnections=Sequence[ConnectionItem]. I think that would support the most scenarios and have the benefit of keeping the workbook and datasource endpoints as similar.jacalata commentedon Aug 25, 2026
The datasource publish signature now mirrors workbook.publish:
datasources.publish(..., connection_credentials=None, connections=None, ...)accepts either a singleConnectionCredentialsOR aSequence[ConnectionItem], and passing both raisesRuntimeError('You cannot set both connections and connection_credentials')(seetableauserverclient/server/request_factory.pyDatasourceRequest._generate_xml). This matches the recommendation in the last comment on this thread. Closing as completed and removing thein-progresslabel.