sql

Harold 2024-10-15T22:36:12.599739Z

Does anyone know of a project that would introspect (presumably with jdbc) a given database and exfiltrate all the data from the database as Clojure data (in memory, edn-ish)? I've been given some H2 .db files that I think I could explore more easily if the data were just clojure data rather than sql. Is such a thing even possible (does jdbc enable enough introspection)?

seancorfield 2024-10-15T22:42:55.316859Z

Some databases provide an information_schema that has metadata about tables and columns. Not sure about H2.

seancorfield 2024-10-15T22:43:26.565779Z

Donut xray is a library that might help you here.

seancorfield 2024-10-15T22:43:44.609119Z

https://github.com/donut-party/dbxray

👍 1
🍩 2
Harold 2024-10-15T22:45:19.199569Z

Thanks, that does look relevant.

p-himik 2024-10-15T22:45:50.534099Z

Just in case - note that you'll likely lose some information that way due to type mappings.

Harold 2024-10-15T22:46:58.533079Z

That makes sense... If I need to do it myself, I can probably employ TMD, which will give me some leverage. What kind of lossage are you imagining @p-himik?

p-himik 2024-10-15T22:49:38.938569Z

I meant only in terms of data. If you also introspect the schema and keep it in mind, then it's likely that there will be no loss. Just take a look at https://www.h2database.com/html/datatypes.html and think which H2 types map to which Clojure types. :) I imagine all four text types along with the enum type will be represented as Java strings.