A database is indispensable when developing a system. However, depending on the technique, there is tremendous data depending on the technique used in that case, but there is a risk that data will be lost or taken out by erroneous coding.
SQLCheck is what I would like to use there. Let's pre-check the problem, risky SQL.
How to use SQLCheck
Execution result of SQLCheck. Just pass the SQL file.
- $ sqlcheck -f /path/to/tmp-publisher.sql
- -------------------------------------------------
- > RISK LEVEL :: ALL ANTI-PATTERNS
- > SQL FILE NAME :: /path/to/tmp-publisher.sql
- -------------------------------------------------
- ==================== Results ===================
- -------------------------------------------------
- SQL Statement: create table user ( id text primary key, customer_id text, -- customer provided
- id email text, phone text, name text, uploaded boolean, created_at bigint,
- updated_at bigint );
- [/path/to/tmp-publisher.sql]: (HIGH RISK) (LOGICAL_DATABASE_DESIGN ANTI-PATTERN) Multi-Valued Attribute
- [Matching Expression: id text]
- [/path/to/tmp-publisher.sql]: (HIGH RISK) (LOGICAL_DATABASE_DESIGN ANTI-PATTERN) Generic Primary Key
- [Matching Expression: id ]
- :
- -------------------------------------------------
- SQL Statement: create index user_customer_id on user (customer_id);
- [/path/to/tmp-publisher.sql]: (LOW RISK) (PHYSICAL_DATABASE_DESIGN ANTI-PATTERN) Index Attribute Order
- [Matching Expression: create index]
- :
- ==================== Summary ===================
- All Anti-Patterns :: 7
- > High Risk :: 4
- > Medium Risk :: 0
- > Low Risk :: 3
Depending on the condition, it determines that the risk is high, middle, low and gives the result. Since it checks with anti pattern in SQL, if you check the SQL log executed by the system, you should see improvement points.
SQLCheck is C ++ open source software (Apache Licnese 2.0).
No comments:
Post a Comment