-
Notifications
You must be signed in to change notification settings - Fork 25.2k
SQL: Refactor Tableau connector to make use of the connection properties #69169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
2b31164
caffe93
4190b61
397d6c6
af4e372
d6add92
2d1790e
c131b3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function propertiesbuilder(attr) { | ||
var props = {}; | ||
|
||
props["user"] = attr["username"]; | ||
props["password"] = attr["password"]; | ||
|
||
var extraProps = attr[connectionHelper.attributeWarehouse]; | ||
if (extraProps != null && extraProps.trim().length > 0) { | ||
var avps = extraProps.trim().split(/[\s&]/); | ||
for (var i = 0; i < avps.length; i++) { | ||
var tokens = avps[i].split("="); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question, to be more lenient shouldn't we trim the split tokens, to treat something like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space is accepted as a delimiter between the AVPs, as a friendlier alternative to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thx for explaining! |
||
if (tokens.length != 2 || tokens[0].length == 0 || tokens[1].length == 0) { | ||
logging.log("Malformed AVP: [" + avps[i] + "] in additional params: [" + extraProps + "]"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess what AVP means, but I am not sure. Especially this being a logged message, I'd give it a meaningful name. Something like "Malformed attribute-value pair:......" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acronym expanded. |
||
var errMessage = "Invalid additional settings property `" + avps[i] + "`: " + | ||
"not conforming to the attribute=value format." | ||
return connectionHelper.ThrowTableauException(errMessage); | ||
} else { | ||
props[tokens[0]] = tokens[1]; | ||
} | ||
} | ||
} | ||
|
||
return props; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the question mark at the end always necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes: the "user" is a mandatory config option (can't submit the form if not filled), so there will always be a property set; so adding the
?
is safe.