Maybe I am biased, but at this point I would find simpler to just give access to the DB.
Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.
Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.
Databases are huge security vulnerabilities and should always have some kind of shim over them. Never expose your relational DB publicly if you want any control over it.
Or (as is the fashion recently) compile sqlite to wasm and run it in browser.