DataONEorg / hashstore

HashStore, a hash-based object store for DataONE data packages
Apache License 2.0
1 stars 1 forks source link

Accessing postgres query results without index integer values #106

Closed doulikecookiedough closed 1 month ago

doulikecookiedough commented 1 month ago

The existing client code to test and work with a metacat db (in knbvm) loops over sql results and creates a new list. This is done through a for loop and assigns variables based on a row index integer value.

Investigate removing the integer values and replace it with the row values to improve clarity, and reduce confusion if the database schema changes.

doulikecookiedough commented 1 month ago

After executing a SQL query to retrieve specific columns/values - the column names are not included in the query result set (each row is a tuple item). So the way to accesss each row's contents is through the index positions. I could map the result set with header values, but it adds overhead that I feel is unnecessary since this area of the hashstoreclient is primarily for testing purposes.

If the database schema changes (I am assuming that this is highly unlikely), we will need to revise our SQL query accordingly. If that happens, I will investigate this further and see how it can be improved.