Skip to content

schemaValidation check #175

@csrvsk

Description

@csrvsk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions