Changes

Jump to navigation Jump to search
Since writing raw SQL is a bit cumbersome and error-prone, I have added some abstraction layers that make it much easier to quickly add bulk data. By using Postgres's <code>CopyManager</code> class, we buffer SQL copy commands in memory (as many as possible) and then flush these rows. To understand how the abstraction layers work, see the code in <code>E:\McNair\Projects\SimplerPatentData\src\main\java\org\bakerinstitute\mcnair\postgres</code>. See <code>E:\McNair\Projects\SimplerPatentData\src\main\java\org\bakerinstitute\mcnair\models\GrantedPatent.java</code> for '''an example of how to extend''' the abstraction layer to deal with more complex scenarios.
 
=== New Table Checklist ==
 
* Create schema DDL SQL code for the new table in <code>E:\McNair\Projects\SimplerPatentData\src\db</code>
* Run the schema creation
* Create an enum with the same names for attributes as in the DDL (case-insensitive! prefer all-caps screaming snake case)
* Create a class which subclasses <code>AbstractIntertableData</code>
* Inside that class, create a static class which subclasses <code>AbstractTableMetadata</code> and has the proper values for getTableName(), getStringColumns(), getIntColumns()
* (Optional) Implement builder pattern
* (Optional) Create a custom databasehelper for complex extras (see PatentApplication and GrantedPatent for examples)
* Write the data to the table (see DatabaseHelper for the pattern I use)
== Address Data ==

Navigation menu