Skip to content

Conversation

@stepansergeevitch
Copy link
Collaborator

Fixed engine renaming for fb2.0

@stepansergeevitch stepansergeevitch self-assigned this Aug 13, 2024
@stepansergeevitch stepansergeevitch requested a review from a team as a code owner August 13, 2024 08:12
@stepansergeevitch stepansergeevitch changed the title Fir 35673 python sdk engine update fix renaming fix: Fir 35673 python sdk engine update fix renaming Aug 13, 2024
Copy link
Contributor

@ptiurin ptiurin left a comment

Choose a reason for hiding this comment

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

Some minor comments, otherwise looks good.

param, value
parameters: List[Union[str, int]] = []
if name is not None:
if not self._engine_name_re.match(name):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking from a readability perspective, we can potentially do name.replace('_', '').isalnum() here and avoid regex altogether.
Don't feel too strongly about it, so up to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would rather stick to the regexp as it fells more straightforward, while removing characters might be slightly confusing during reading

)
DROP_SQL: ClassVar[str] = 'DROP ENGINE "{}"'

_engine_name_re = re.compile(r"^[a-zA-Z0-9_]+$")
Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep the regex approach let's pop a comment above it - "engine names can only be alphanumeric with underscores". Saves a second having to read the regex itself.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
75.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@stepansergeevitch stepansergeevitch merged commit 70d41ec into main Aug 13, 2024
@stepansergeevitch stepansergeevitch deleted the FIR-35673-python-sdk-engine-update-fix-renaming branch August 13, 2024 13:49
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.

2 participants