Tableau Prep Builder allows you to create a JSON file with database connection information for data sources associated with a flow. There are two different versions of the credentials JSON format. Version 1 looks like this:
{
"inputConnections":[
{
"hostname":"https://my.server",
"contentUrl": "mysite",
"port":443,
"username": "jsmith",
"password": "passw0rd$"
}
]
}
Version 2, which you can use with Tableau Prep Builder 2020.3.1 and later, looks like this:
{
"databaseConnections":[
{
"hostname":"example123.redshift.amazonaws.com",
"port":"5439",
"username":"jsmith",
"password":"p@s$w0rd!"
}
]
}
Unfortunately, it doesn't seem like there's a way in the V2 credentials format to specify the name of the database you want to connect to on the server. If you try to add a field like "database" to the connection JSON, you get an unhelpful error:
Unable to read the connections file. Details:
Unrecognized field "databaseConnections" (class com.tableau.tprep.cli.app.connections.ConnectionInfo), not marked as ignorable (3 known properties: "inputConnections", "extensions", "outputConnections"])
at [Source: (FileInputStream); line: 18, column: 2] (through reference chain: com.tableau.tprep.cli.app.connections.ConnectionInfo["databaseConnections"])
The error suggests that it's looking for the fields for the V1 format, even though I'm using Tableau Prep Builder 2021.4 and the output includes a line which reads "The connection file is in V2 format." Googling didn't turn anything up that helped - just threads on the Tableau support forums of people having similar issues.
If you try to add the database name to the end of the hostname, like in a connection string URL (e.g. "hostname.com/databasename", you get a slightly more helpful error:
We don't have credentials of all connections in tfl/tflx file. The following connection(s) were not found: <database name>
If you throw caution to the wind and try to connect without specifying a database name at all, you get that error again, but it's less helpful this time.
Luckily, the V1 credentials format still works. The field named "contentUrl" can be used to specify the name of the database that you want to connect to. Replace your V2 credentials.json with a V1-formatted one, and it just works.
No comments:
Post a Comment