Don't know if this helps at all but "SQL" and "flat file" are not mutually exclusive terms. My
SQL::Statement supports SQL access to dozens of different kinds of flat files including CSV, DBM (including BerkeleyDB), XML, etc. If you have lots of legacy code using SQL, you could fairly easily use S::S to write a DBD for your metadata format. If you go that route, look at
DBD::BDM and
DBD::File (both in the
DBI distribution) which both have notes on how to make a custom DBD on top of S::S.