Download Import Script

Download our PostgreSQL import script:

curl -O https://app.chartdb.io/bash-scripts/psql-import.sh
chmod +x psql-import.sh

Usage

Run the script with your database credentials and ChartDB information:

./psql-import.sh \
  -h your-database-host \
  -p 5432 \
  -U your-database-user \
  -d your-database-name \
  -W your-database-password \
  -a your-chartdb-api-key \
  -t your-diagram-id

Required Parameters

  • -h Database hostname
  • -p Database port (default: 5432)
  • -U Database username
  • -d Database name
  • -W Database password
  • -a ChartDB API key
  • -t Target diagram ID

The script will connect to your database, extract the schema, and automatically import it into your ChartDB diagram.

Automated Daily Updates

To automatically update your diagram daily using cron, add the following line to your crontab:

# Run at 2 AM every day
0 2 * * * /path/to/psql-import.sh -h host -p 5432 -U user -W pass -d dbname -a api_key -t diagram_id >> /path/to/psql-import.log 2>&1

To edit your crontab:

crontab -e

Note: Replace /path/to/psql-import.sh with the absolute path to the script and adjust the credentials accordingly. The log file path (/path/to/psql-import.log) should be in a directory where your user has write permissions.