Schemacrawler logo

SchemaCrawler

Free database schema discovery and comprehension tool

Attributes Example

SchemaCrawler allows you to enrich your schema with remarks and custom metadata by loading table and column attributes from a YAML file. This is useful when the database itself does not store remarks, or when you want to annotate the schema externally without modifying the database.

How to Run

Before running this example, complete the setup in Getting Started.

  1. Create a file called “attributes.yaml” with the contents shown below.
  2. Run the command:
schemacrawler \
  --server postgresql \
  --host postgresql \
  --database schemacrawler \
  --user schemacrawler \
  --password schemacrawler \
  --info-level standard \
  --command schema \
  --attributes-file share/attributes.yaml

Replace with the connection options for your chosen database. See Getting Started.

SchemaCrawler will load the schema and overlay the remarks and attributes defined in attributes.yaml onto the output.

To save output to a file, an additional --output-file share/output.txt.

Resource Files

attributes.yaml

name: catalog
tables:
- catalog: null
  schema: books
  name: authors
  remarks:
  - "Overwritten remarks authors table"
  columns:
  - name: firstname
    remarks:
    - Overwritten remarks for firstname at line 1
    - Overwritten remarks firstname at line 2
    attributes:
      tag1: tagvalue1
  - name: lastname
    remarks:
    - Overwritten remarks for lastname

Place this file in your working directory. It will be accessible inside the container as share/attributes.yaml.

(Modify this overrides file appropriately for the other databases.)

How to Experiment