This update provides basic connectivity to postgres via datastore.DataAccessLayer. I added a context manager (session_scope) to add a convenient method to call and exit a db session. I made assumption that db settings will be pulled from env variables as it is for local and Travis tests.
Also created a new module datastore_transactions.py to house any methods to communicate with the db. At the moment there are only two basic operations - I will add more later when I have a better idea what is needed.
Made some changes to tables: opted for internal/independent identifier for the Resource table (previously it had two primary keys: sierraId and libraryId), but that somewhat complicated relations between the tables (double foreign keys?). Instead I added a unique constraint for combination of sierraId and libraryId that should accomplish the same thing.
Do I need to worry about character encoding in Postgres? Collation? I had some issues in MySQL, but it looks Postgres is handling it better.
It took me a while to figure out correct Travis settings to install Posgresql 13 (their default is 9.6 which I thought may not be a good idea). Made some silly but frustrating mistakes along the way...
datastore.DataAccessLayer
. I added a context manager (session_scope
) to add a convenient method to call and exit a db session. I made assumption that db settings will be pulled from env variables as it is for local and Travis tests.It took me a while to figure out correct Travis settings to install Posgresql 13 (their default is 9.6 which I thought may not be a good idea). Made some silly but frustrating mistakes along the way...