schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.6k stars 199 forks source link

Implementing thymeleaf templates for lint reporting #55

Closed adriens closed 8 years ago

adriens commented 8 years ago

Hi @sualeh , we are beginning to investigate on custom lint reporting. Unfortunately we have no example on how to do this on lints : could you provide us some dummy example (a list of table lints should do the trick) so we can start to prototype something this week ?

Thank you in advance for your help.... we have some really cool ideas but d'ont know how to start ;-(

ThisGuenter commented 8 years ago

Hi @adriens , i'm using schemacrawler lint in an ORACLE project, if you mean with "table lints" the "schemacrawler.tools.linter.LinterTableSql" or " schemacrawler.tools.linter.LinterCatalogSql" linters - here two examples from our schemacrawler-linter-configs.xml: `

true
    <severity>high</severity>
    <config>
        <property name="message">tables without INSERTED_AT/INSERTED_BY -</property>
        <property name="sql">

SELECT LISTAGG(ut.table_name, '|') WITHIN GROUP(ORDER BY ut.table_name) table_names_list FROM user_tables ut WHERE EXISTS (SELECT 1 FROM user_tab_privs utp WHERE utp.table_name = ut.table_name AND utp.privilege = 'INSERT') AND '|INSERTED_AT|INSERTED_BY' != (SELECT '|' || LISTAGG(utc.column_name, '|') WITHIN GROUP(ORDER BY utc.column_name) FROM user_tab_cols utc WHERE utc.table_name = ut.table_name AND utc.column_name IN ('INSERTED_AT','INSERTED_BY')) Notice the use of ${table} to indicate the name of the table(schema.tablename), ${schema} and ${tablename} the "schemacrawler.tools.linter.LinterTableSql" linter is running against.

true high constraints not starting with same prefix - SELECT LISTAGG(uc.constraint_name, '|') WITHIN GROUP(ORDER BY uc.constraint_name) constraint_names_list FROM user_constraints uc WHERE uc.table_name = '${tablename}' AND uc.generated = 'USER NAME' GROUP BY uc.table_name HAVING COUNT(DISTINCT SUBSTR(uc.constraint_name, 1, INSTR(uc.constraint_name, '_', 1, 2) - 1)) > 1

` I assume you neet to utilize the INFORMATION_SCHEMA tables.

adriens commented 8 years ago

Hi @ThisGuenter , thank you for your help. Indeed, i don't have a problem with using lint configuration. What i need is to know how to accesslint informations from thymeleaf to produce custom html lint reports.

schemacrawler commented 8 years ago

Duplicate of #35