chapter six

6 Storing our ACH files

 

This chapter covers

  • Creating tables within our PostgreSQL database
  • Designing a relational database capable of storing ACH files
  • Using Python and Pydantic to validate our ACH records and store them in our database
  • Ensuring our records are parsed and stored correctly by unit testing with pytest

Databases store and persist our data across application instances while providing a way to query and ensure the integrity of that data. In this chapter, we dive into what it will take to store our ACH files in a database. After our initial analysis we then work on expanding our APIs to allow storing an ACH file into the database. Continuing along that track we expand our parsers to store the individual fields as well. Finally, we wrap up the chapter by examining the impact of storing ACH data has on our unit and load tests.

6.1 Designing our Database

6.2 Using SQL Directly

6.2.1 Adding records to the ach_files table

6.3 Storing the file header record

6.4 Storing the rest of our ACH records

6.4.1 Storing ACH Files Challenge – Lessons Learned

6.5 Storing Exceptions

6.6 Uploading an ACH file

6.7 Storing Records with Integrity

6.8 Using Pydantic

6.9 Lessons Learned

6.10 Coding Changes

6.10.1 Creating Pydantic schema for the unparsed ACH Records

6.10.2 Creating Pydantic schema for the parsed ACH records

6.10.3 Unit test changes

6.11 Design and Different Approaches

6.12 Summary