This is a quick and simple program designed to convert a SQL file dump from PostgreSQL over to a set of Serialized Builder POJOs for each database table.
Note: This is my first GitHub project. I am publishing this project because I thought others might find use in it and/or be willing to contribute towards improving it further. For now this does all I need it to do, but as I use it, I'm sure I will come up with additional wish list items and continue to grow the program as they are added in.
Program Usage:
sql2pojo [options] [input SQL path/file] [pojo output path] [java package name]
Options: -h || --h Displays usage information and a program information message -i Ignores shema/db names for input SQL file on the CREATE TABLE line e.g. MyDB.TableName becomes TableName
ToDo:
-
Need to improve args parsing to be much more robust, very kludgy at the moment
-
Need to go back and remove most of the debug code but for now you can set DebugLevel to 0 or 1 to avoid seeing it.
-
Need to support Windows - now this is primarily using Linux/Unix path and file strings
-
Need to add support for MySQL and/or other versions or variations of SQL files
-
Need to add support for additional data types within PostgreSQL as well as others
-
Need to add more robust support for keyword parsing of SQL files for items removed e.g. ON DELETE, NOT DEFERRED
-
Nice to have would be to break the project up into multiple files for better manageability
-
Could change output file from a list to a string using ConCat, but this seemed a bit easier to manage with List
-
Could also add better, more robust support for other character sets or localization for other languages besides english
-
Could add optionally enable the Serialization/Builder vs. having it be the current default and only POJO pattern
-
Need to add in a imports/libraries section
-
Need to add option for adding decorators as well
-
Would be nice if this could select output lanaguge to support POCO/C# or other programming languages besides just POJO/Java e.g. Python, Ruby, VB