eralchemy
eralchemy copied to clipboard
reading relationships from Postgresql database
Hello,
I wanted to create .er file based on schema in Postgresql database. It works well for tables, but ignores relationships.
Example script
psql t1 -c "CREATE SCHEMA t1;
CREATE TABLE t1.parent(id INTEGER PRIMARY KEY);
CREATE TABLE t1.child (id INTEGER PRIMARY KEY,
parent_id INTEGER REFERENCES t1.parent(id) NOT NULL)"
eralchemy -i 'postgresql+psycopg2:///t1' -s t1 -o t1.er
cat t1.er
yields output
[t1.parent]
*id {label:"INTEGER"}
[t1.child]
*id {label:"INTEGER"}
parent_id {label:"INTEGER"}
ignoring FOREIGN KEY constraint. Is it intended?
I'm using PostgreSQL 9.6.10 on Ubuntu 18.04 and ERAlchemy version 1.2.10.
Same problem for me. It ignores relations between tables when my input is an existing postgres instance.
Same problem here!
I have this issue as well.
I could not reproduce this on my fork (https://github.com/maurerle/eralchemy2):
t1.er
[parent]
*id {label:"INTEGER"}
[child]
*id {label:"INTEGER"}
parent_id {label:"INTEGER"}
parent ?--* child
But this should also work with the latest eralchemy version (with sqlalchemy < 1.4)