Skip to content
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

schemaValidation check #175

Open
csrvsk opened this issue Oct 26, 2023 · 0 comments
Open

schemaValidation check #175

csrvsk opened this issue Oct 26, 2023 · 0 comments

Comments

@csrvsk
Copy link

csrvsk commented Oct 26, 2023

Hi felipe,

I am trying to find a way to validate schema names (supplied list) using SQL operations like

private static final List<String> SQL_OPERATIONS = Arrays.asList(
    "CREATE TABLE", "ALTER TABLE", "DROP TABLE",
    "CREATE INDEX", "ALTER INDEX", "DROP INDEX",
    "CREATE VIEW", "ALTER VIEW", "DROP VIEW",
    "CREATE PROCEDURE", "ALTER PROCEDURE", "DROP PROCEDURE",
    "CREATE FUNCTION", "ALTER FUNCTION", "DROP FUNCTION",
    "CREATE TRIGGER", "ALTER TRIGGER", "DROP TRIGGER",
    "CREATE SEQUENCE", "ALTER SEQUENCE", "DROP SEQUENCE",
    "CREATE SYNONYM", "DROP SYNONYM",
    "CREATE PACKAGE", "ALTER PACKAGE", "DROP PACKAGE",
    "CREATE TYPE", "ALTER TYPE", "DROP TYPE"
);

Please guide me how to achieve this...

Goal is to make sure that usage of above SQL operations in the code must comply with schemaName standards or conditions as specified.

I am able to find a way to validate schema (with the format of schemaName.tableName) name while using CREATE_TABLE and also ALTER_TABLE from DdlGrammar.

Right now I am unable to figure out the right constant for DROP TABLE. Not sure about other other SQL operations. Please advise on other operations as well.

Or
If you have a more direct and straight forward approach for schemaValidation, please guide me how to implement a check.

Just FYI,
I have also tried ZPA parser tool to check for DROP TABLE

image

Looking at that I subscribed to DROP_COMMAND, but it doesn't work either.

Thanks
vsk

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

No branches or pull requests

1 participant