Skip to content

This project is designed to split an SQL script file (DDL structure only) into several files, and categorize these files based on the objects such as tables, views, functions, stored procedures, sequences, etc.

Notifications You must be signed in to change notification settings

ratminurisnaini/DDL-SQL-File-Management

Repository files navigation

DDL-SQL-File-Management

This project is designed to split an SQL script file (DDL structure only) into several files, and categorize these files based on the objects such as tables, views, functions, stored procedures, sequences, etc. The project is built to split MySQL DDL script and PostgreSQL DDL script extracted from Navicat. The main codes are "MySQL Splitting.py" and "PostgreSQL Splitting.py" in this repository.

The "MySQL Splitting.py" file splits a MySQL DDL script file into table, view, function, procedure, and trigger files. The sample database used is the Sakila database (from https://dev.mysql.com/doc/sakila/en/) located in the "MySQL Sample Database" folder. The MySQL splitting results are located in the same folder.

The "PostgreSQL Splitting.py" file splits a PostgreSQL DDL script file into type, sequence, table, index, function, procedure, view, and trigger files. The sample database used is the DVD Rental database (from https://www.postgresqltutorial.com/postgresql-getting-started/postgresql-sample-database/) located in the "PostgreSQL Sample Database" folder. The PostgreSQL splitting results are located in the same folder.

The PostgreSQL file splitting is more complex than the MySQL file splitting because this system has more text patterns to search. For example, DDL script to create primary & foreign keys, and DDL script to create clustered indexes. Besides that, there are more processes to be handled such as handling more than one object with the same names. Because PostgreSQL has schemas, this system can only process one schema file in one execution. For the next execution with a different schema, the system will combine all the objects from all the schemas executed. If there are objects with similar names, then they will be named using sequences, for example, customer_1, customer_2, etc.

About

This project is designed to split an SQL script file (DDL structure only) into several files, and categorize these files based on the objects such as tables, views, functions, stored procedures, sequences, etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published