[컴] SchemaSpy 사용

reverse engineering / db schema / how to get db schema / ERD

SchemaSpy 사용하기

windows 에서 설치

사용가능한 database

사용가능한 db 의 종류는 아래 command 로 확인할 수 있다.

java -jar schemaSpy_5.0.0.jar -dbhelp

run

여기서는 postgresql 의 database 에 대한 작업을 할 것이다.

postgresql 은 pgsql-t pgsql 을 이용하면 된다. 옵션에 대한 설명은 Commonly used parameters | SchemaSpy 6.0.0 documentation 를 참고하자.

%java% -jar schemaSpy_5.0.0.jar -t pgsql -host <localhost> -db <database_name> -u <user-id> -p <password> -o f:\ -dp postgresql-42.2.20.jar

그리고 난 후 index.html 을 열어보면 된다.

<output_dir>/index.html

실행모습

D:\a\apps\schemaSpy>d:\a\apps\java\openjdk-jdk-15.0.1\bin\java.exe -jar schemaspy-6.1.0.jar -t pgsql -host localhost:5432 -db mydb -u mytestuser -p mypw -dp postgresql-42.2.20.jar -o f:\schema
  ____       _                          ____
 / ___|  ___| |__   ___ _ __ ___   __ _/ ___| _ __  _   _
 \___ \ / __| '_ \ / _ \ '_ ` _ \ / _` \___ \| '_ \| | | |
  ___) | (__| | | |  __/ | | | | | (_| |___) | |_) | |_| |
 |____/ \___|_| |_|\___|_| |_| |_|\__,_|____/| .__/ \__, |
                                             |_|    |___/

                                              6.1.0

SchemaSpy generates an HTML representation of a database schema's relationships.
SchemaSpy comes with ABSOLUTELY NO WARRANTY.
SchemaSpy is free software and can be redistributed under the conditions of LGPL version 3 or later.
http://www.gnu.org/licenses/

INFO  - Starting Main v6.1.0 on DESKTOP-3TJIL3S with PID 13112 (D:\a\apps\schemaSpy\schemaspy-6.1.0.jar started by namh in D:\a\apps\schemaSpy)
INFO  - The following profiles are active: default
INFO  - Started Main in 0.771 seconds (JVM running for 1.047)
INFO  - Starting schema analysis
INFO  - Connected to PostgreSQL - 13.2
INFO  - Gathering schema details
Gathering schema details...............................................................WARN  - Failed to retrieve stored procedure/function details using sql 'select r.routine_name, case when p.proisagg then 'AGGREGATE' else 'FUNCTION' end as routine_type, case when p.proretset then 'SETOF ' else '' end || case when r.data_type = 'USER-DEFINED' then r.type_udt_name else r.data_type end as dtd_identifier, r.external_language as routine_body, r.routine_definition, r.sql_data_access, r.security_type, r.is_deterministic, d.description as routine_comment from information_schema.routines r left join pg_namespace ns on r.routine_schema = ns.nspname left join pg_proc p on ns.oid = p.pronamespace and r.routine_name = p.proname left join pg_description d on d.objoid = p.oid where r.routine_schema = :schema'
오류: p.proisagg 칼럼 없음
  Hint: 아마 "p.prolang" 칼럼을 참조하는 것 같습니다.
  Position: 34
(0sec)
Connecting relationships...............................................................(0sec)
Writing/graphing summary.INFO  - Gathered schema details in 0 seconds
INFO  - Writing/graphing summary
INFO  - Graphviz rendered set to ''
........(8sec)
Writing/diagramming detailsINFO  - Completed summary in 8 seconds
INFO  - Writing/diagramming details
............................................................(15sec)
Wrote relationship details of 60 tables/views to directory 'f:\schema' in 25 seconds.
View the results by opening f:\schema\index.html
INFO  - Wrote table details in 15 seconds
INFO  - Wrote relationship details of 60 tables/views to directory 'f:\schema' in 25 seconds.
INFO  - View the results by opening f:\schema\index.html
INFO  - StackTraces have been omitted, use `-debug` when executing SchemaSpy to see them

D:\a\apps\schemaSpy>

댓글 없음:

댓글 쓰기