Database Schema Generator

i have an excel file which describe all the table structure of a database table

I would like to generate database schema diagram and database schema structure for sqlite3 database from this excel file.

Any idea how to do that ?

Thanks.

Answers


Assuming each tab is named for a table and has cells as such:

Name    DataType
ID    integer
Name    varchar(255)

Use either Python or Java to read the workbook using python-excel or Apache POI for Excel, respectively. I'm sure other languages, particularly .NET have libraries for this purpose as well. Both languages also have drivers for sqlite3.

Iterate through each tab - use the tab name for the table CREATE statement. Iterate through each row on the tab and use that information to define the columns for the table. Defining things like primary/foreign keys and auto incrementing will require some additional cells or a naming convention + some clever algorithms.

Most likely each CREATE statement will need to passed separately over the database connection.


Need Your Help

using sqlcmd to save a table query to CSV, cannot re-import back into the same table definition?

sql-server database csv bulkinsert

I have an extremely large database I need to send to the developer, the table has over 120million rows. the developer says he only needs about 10,000 or so rows so I was going to use the sqlcmd -S...