Skip to content

Instantly share code, notes, and snippets.

@sualeh
Created November 20, 2022 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sualeh/4aebf7098f5907467df20d00f03962cd to your computer and use it in GitHub Desktop.
Save sualeh/4aebf7098f5907467df20d00f03962cd to your computer and use it in GitHub Desktop.
Run Custom Scripts with SchemaCrawler

Run Custom Scripts with SchemaCrawler

See docker-compose and mermaid diagrams

How To Generate mermaid diagrams

  • Save all the files from this gist into a single directory
  • Run docker-compose -f schemacrawler-sqlite-mermaid.yml

How To Run Custom Scripts

  • Save all the files from this gist into a single directory
  • Run docker-compose -f schemacrawler-sqlite-script.yml
version: '3.7'
services:
schemacrawler:
image: schemacrawler/schemacrawler
container_name: schemacrawler
volumes:
- type: bind
source: ./target
target: /home/schcrwlr/testdb
- type: bind
source: ./
target: /home/schcrwlr/share
entrypoint: ['/opt/schemacrawler/bin/schemacrawler.sh']
command: --url="jdbc:sqlite:sc.db" --info-level=standard --command=script --script-language=python --script=mermaid.py --output-file=share/db-schema.mmd
version: '3.7'
services:
schemacrawler:
image: schemacrawler/schemacrawler
container_name: schemacrawler
volumes:
- type: bind
source: ./target
target: /home/schcrwlr/testdb
- type: bind
source: ./
target: /home/schcrwlr/share
entrypoint: ['/opt/schemacrawler/bin/schemacrawler.sh']
command: --url="jdbc:sqlite:sc.db" --info-level=standard --command=script --script-language=python --script=share/tables.py --output-file=share/db-schema.txt
print(catalog.crawlInfo)
for table in catalog.tables:
print('')
print(table.fullName)
for childTable in table.referencingTables:
print(" [child] " + childTable.fullName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment