PostgreSQL
To use Liam ERD in a PostgreSQL environment, you can simply parse an .sql
file generated by commands such as pg_dump --schema-only
. Below is a guide on how to create an ER diagram using a PostgreSQL dump file.
Using a pg_dump-generated SQL File
For example, you can dump only the database schema into a file named schema.sql
with the following command:
You may also consider using the following options, because privilege-related statements and owner information are generally unnecessary for ER diagrams:
--no-privileges
: Excludes all privilege-related statements (e.g.,GRANT
/REVOKE
) from the dump.--no-owner
: Omits ownership statements (e.g.,ALTER TABLE ... OWNER TO ...
).
Once you have generated schema.sql
, you can use Liam CLI to build an ER diagram.
Specify --format postgres
and --input schema.sql
as follows:
If the above command runs successfully, an ER diagram will be generated.
Under the Hood
For parsing PostgreSQL SQL files, Liam CLI relies on the following libraries: