CSV metadata based ER diagram

Hello community,

I have a set of 30 odd sql files. I don’t know their structures. At the same time, I would like to generate DDLs out of these structures with primary and foreign key relationships. For an example, if I have a Product CSV and an Order CSV files, I would like to:

  1. Read their schema automatically in Python and generate a DDL (any database will work).

  2. Let’s say once DDLs are generated for both files, I can see Product ID, which is a primary key in Product table, is also a foreign key in Order table. I would like to detect/suggest this relationship automatically by scanning metadata of schemas gathered in step 1.

Both steps must be automated in Python if possible.

Any help would be much appreciated.


Any suggestions please?