You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to register a SQLValidator implementation (with some custom rules) in my Superset v5.0.0 deployment, but I've come up against an issue with the implementation of ValidateSQLCommand (or perhaps a limit of my understanding of this feature).
I've updated the configuration for the SQL_VALIDATORS_BY_ENGINE dict in my superset_config.py file to include a reference for my engine:
However, the code which resolves this SQL Validator name is in superset/sql_validators/init.py, with a hardcoded reference to the implementations provided by Superset (for Presto and PostgreSQL):
The function defined in this file (get_validator_by_name) is then used by the ValidateSQLCommand to run the validation implementation. I have an implementation for MySQLValidator (extending BaseSQLValidator)
Have I misunderstood the intended mechanism for bringing your own SQLValidator implementations? It seems that there's no way to do this at the moment without modifying the behaviour of the get_validator_by_name function. Ideally, I'd be able to affect this through modifying the configuration only - maybe something like:
# A mapping from the named SQLValidator implementations and the
# classes which provide the validation. Implementations are provided
# for the PrestoDBSQLValidator and PostgreSQLValidator in the
# sql_validators module
SQL_VALIDATORS_BY_NAME = {
"MySQLValidator": superset.custom.MySQLValidator,
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am attempting to register a SQLValidator implementation (with some custom rules) in my Superset v5.0.0 deployment, but I've come up against an issue with the implementation of ValidateSQLCommand (or perhaps a limit of my understanding of this feature).
I've updated the configuration for the
SQL_VALIDATORS_BY_ENGINE
dict in my superset_config.py file to include a reference for my engine:However, the code which resolves this SQL Validator name is in superset/sql_validators/init.py, with a hardcoded reference to the implementations provided by Superset (for Presto and PostgreSQL):
The function defined in this file (get_validator_by_name) is then used by the ValidateSQLCommand to run the validation implementation. I have an implementation for MySQLValidator (extending BaseSQLValidator)
Have I misunderstood the intended mechanism for bringing your own SQLValidator implementations? It seems that there's no way to do this at the moment without modifying the behaviour of the get_validator_by_name function. Ideally, I'd be able to affect this through modifying the configuration only - maybe something like:
superset/sql_validators/init.py
and
superset/config.py
Beta Was this translation helpful? Give feedback.
All reactions