Oct-19-2023, 01:01 PM
I'm looking for a better python library to create ER diagrams.
I want to input pandas tables as tables and then add relationships between tables.
I tried many libraries, finally found this "pandaserd" library but it doesn't create visualized diagram as file output, instead it require to paste the output code to another web page to generate the visual.
Thanks in advance
I want to input pandas tables as tables and then add relationships between tables.
I tried many libraries, finally found this "pandaserd" library but it doesn't create visualized diagram as file output, instead it require to paste the output code to another web page to generate the visual.
import pandaserd # Create two DataFrames, one for each entity in the ERD customer_df = pd.DataFrame({'id': [1, 2, 3], 'name': ['Alice', 'Bob', 'Carol']}) order_df = pd.DataFrame({'id': [1, 2, 3], 'customer_id': [1, 2, 3]}) # Create a pandaserd.ERD object erd = pandaserd.ERD() # Add the DataFrames to the ERD object erd.add_table( customer_df,'Customer', bg_color='pink') erd.add_table(order_df,'Order', bg_color='skyblue' ) # Specify the relationship between the entities erd.create_rel('Customer', 'Order', left_on='id', right_on='customer_id', left_cardinality='*', right_cardinality='*') erd.write_to_file('output.txt')
Output:erd.write_to_file('output.txt')
written to output.txt; visit https://edotor.net/ to render ERD
Is there a proper working python library to create ER diagrams as visual file with proper connectors?Thanks in advance