m3tti / borkweb

🥇 babashka`s first fullstack clojure framework. That works with jvm clojure. ❗Batteries included❗
https://borkweb.org
MIT License
82 stars 4 forks source link

Support sqlite3 #1

Open fonghou opened 1 month ago

fonghou commented 1 month ago

Support pod-babashka-go-sqlite3 out of box in bb.edn.

It'd be even simpler just bb dev to start a full-stack app.

m3tti commented 1 month ago

Hey @fonghou i'm currently working on integrating hsql to borkweb. Which is basically a file based sql database like sqlite and it supports the entire workflow that is currently in place with borkweb. Would that be sufficient for you? or do you need sqlite.

m3tti commented 1 month ago

https://github.com/m3tti/borkweb/commit/90671d3415d9341f860422b5ba4e98558cf7c8de hypersql added to master

fonghou commented 1 month ago

Hey @m3tti, thanks for the update. I think sqlite3 would still be valuable for borkweb because it doesn't need a heavy JVM to run whereas hsql does. In addition, sqlite3 has much larger ecosystem than hsql e.g. https://litestream.io.

m3tti commented 1 month ago

good point i'll take a look into it. i love sqlite :D it fits the theme of borkweb really well. Btw you are always welcome to participate ;)

m3tti commented 1 month ago

ok looked into it i guess the easiest way would be to extend the pods from @borkdude over here https://github.com/babashka/babashka-sql-pods

borkdude commented 1 month ago

The https://github.com/babashka/pod-babashka-go-sqlite3 can be used directly, why would you want to use babashka-sql-pods for sqlite?

m3tti commented 1 month ago

I could be wrong but doesn't the https://github.com/babashka/pod-babashka-go-sqlite3 have two diffrent functions for quering and executing? Maybe i'm wrong but if that isn't the case and it fits the normal jdbc workflow that would be awesome.

borkdude commented 1 month ago

The API is probably inspired by the underlying golang library but perhaps a small layer in between in borkweb would fix that incompatibility

m3tti commented 1 month ago

Ok i guess that should be the way to go than. Due to the fact that the sqlite3 port to for jdbc seems a little bit hard to accomplish in short term i guess. I'll look into it.

m3tti commented 3 weeks ago

currently i have added in https://github.com/m3tti/borkweb/tree/1-support-sqlite3 a first simple version of sqlite. The current problem i have is that the results get no namespaces for the returning maps. Meaning i have {:name value} but i want to have {:tablename/name value} no clue if thats easily doable. Furthermore an insert doesn't return the keys of the entity like in jdbc. Currently no clue how to work around it. I guess one solution would be if we figure out the table name we can query the db for the entry that just got written by the internal sqlite id that's supported for each entry and returned by the sqlite pod. Any other ideas @borkdude @fonghou ?