-
Notifications
You must be signed in to change notification settings - Fork 28
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
Business roles absent in business_role.yaml but specified in user.yaml are implicitly created and granted #150
Comments
It is an interesting question: "How many explicit validation do we want to have in the codebase?" Each validation helps a bit, but it also increases the amount of code and makes it more difficult to re-shuffle things in future. Also, the only way to truly "validate" a config is to apply it to live Snowflake account. In this specific case the workflow seems to be roughly the same:
That's why this specific validation is currently not there. We actually have some other validations in place in parsers: https://github.com/search?q=repo%3AlittleK0i%2FSnowDDL%20ValueError&type=code Mostly covering use-cases when lack of validation can silently break something. Like empty placeholders, incorrect pattern matchings, etc. |
I believe cross-references between blueprints can be validated, i.e. BRole granted Global Roles may have no validation, but references to WH, BRoles or TRoles should be validated. |
The question is how to organize it in the code to make such checks relatively "clean". The most simple solution is to add a generic function to AbstractParser throwing error:
... but it would be nice to know the context. For example:
That's great, but code would look like tons of IF statements. Maybe it is not too bad if moved into a dedicated "validate" function. |
At this moment exceptions during parsing include path to file which caused an exception. Works very well for schema objects (tables, views, etc.). Does not work so well for account-level objects, such as business roles, since all roles are in the same file. And some configs may have hundres of such roles. |
Describe the bug
No BRole
reporter
is configured, but it is created and granted tomy_user
Expected behavior
I would expect validation error from SnowDDL. It would help in case of typos in user's
business_roles
property or in case of BRole rename.Attach log
Update: it appears that
apply
command fails in that scenario, but notplan
:The text was updated successfully, but these errors were encountered: