-
Notifications
You must be signed in to change notification settings - Fork 26
Bug 1306049 - Sanitize string dimensions passed to "where" #161
Conversation
c11ef07
to
13351db
Compare
moztelemetry/dataset.py
Outdated
for name, path in self.selection_compiled.items()) | ||
|
||
def _sanitize_dim(self, v): | ||
"""For String conditions, we should pre-sanitize so that users of |
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.
Could you format this docstring to follow the pep 257 conventions?
moztelemetry/dataset.py
Outdated
:param v: a string value that should be sanitized. | ||
""" | ||
if v is not None: |
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.
I don't think this condition is needed
moztelemetry/dataset.py
Outdated
raise Exception('The dimension {} doesn\'t exist'.format(dimension)) | ||
if isfunction(condition) or isinstance(condition, functools.partial): | ||
clauses[dimension] = condition | ||
elif isinstance(condition, basestring): |
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.
The value that this condition is checked against is a string, so we can either raise an exception if this is not the case or convert condition to a string. I think the latter solution would make more sense but I don't have a strong opinion about it.
@maurodoglio RFAL |
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.
🚢 it!
33e8d0f
to
e0269b3
Compare
Hide the implementation details about how dimensions are sanitized for S3 storage. This way you can do things like: dataset.where(docType="saved-session") instead of having to know that the hyphen is replaced with an underscore when data is saved (and used "saved_session").
e0269b3
to
d91bc60
Compare
No description provided.