-
Notifications
You must be signed in to change notification settings - Fork 99
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
linter for non-memory-comparable primary keys #204
Comments
Thank you for the feature request! I'd accept a PR for this if it can be made more generic -- I'd envision it as an option that allows you to configure which data types are permissible for use in primary keys. I believe that should still fulfil your use-case (assuming it's only checking column types and not any other aspect of the column?) but still permit companies with similar-but-slightly-different PK limitations to leverage it. The linter package has some helpers for making these "allow lists" easy to code, see e.g. the similar data type checking use-case in allow-auto-inc / lint-auto-inc via check_auto_inc.go. This makes use of the helpers Rule.RelatedListOption and Options.IsAllowed. In terms of option naming and functionality, I can see at least two possible approaches: a) Enhance the existing lint-pk to make data type checking part of it. Add new related option or b) Make this a separate new linter check, That said, definitely open to discussing other approaches! If submitting a PR, a few things to keep in mind:
|
Thank you so much for the pointers! Okay, give me some time and I'll work on a PR. |
Skeema v1.10 has been released and includes this feature (lint-pk-type and allow-pk-type). Thanks again for the pull request! |
I would like to propose a new linter, for which I am happy to provide a PR for. The linter warns when the
PRIMARY KEY
includes a column that is non-memory comparable. i.e.The following types are acceptable:
The following are not:
The use-case is two fold:
This might sound obscure, but I am looking to adopt skeema for this use-case :P We are developing a schema-change tool that has optimizations that depends on memory-comparable keys. When the key is non-memory-comparable, we currently detect it - but it means we need to fall back to a slower schema change method. So being able to lint it at the user level is a win for us.
The text was updated successfully, but these errors were encountered: