lapis icon indicating copy to clipboard operation
lapis copied to clipboard

SQLite3 Support

Open karai17 opened this issue 8 years ago • 23 comments

Any chance of integrating SQLite3 into Lapis? It is a very handy db when you don't need a full server. I'd like to make little isolated Lapis apps that don't depend on running a full psql server.

karai17 avatar Jan 31 '16 14:01 karai17

I would also like this. If nothing else, it would be nice to use a tiny self-contained database for testing things.

TangentFoxy avatar Feb 01 '16 20:02 TangentFoxy

No plans at the moment, but contributions welcome.

When lapis first launched openresty was also optional. Maybe it should be optional again? This way anyone with a working LuaRocks can experiment with the basics of lapis.

leafo avatar Mar 25 '16 18:03 leafo

I don't really see an issue with having openresty mandatory. Lapis is a web framework, so it's to be expected that it should run on a web server...


Landon Manning [email protected]

On 25 March 2016 at 15:46, leaf [email protected] wrote:

No plans at the moment, but contributions welcome.

When lapis first launched openresty was also optional. Maybe it should be optional again? This way anyone with a working LuaRocks can experiment with the basics of lapis.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/leafo/lapis/issues/394#issuecomment-201416999

karai17 avatar Mar 25 '16 18:03 karai17

I switched to openresty only because it was easier to maintain one server, openresty has certain characteristics that are valuable, and lapis does some things specifically for nginx (the configuration generation)

I don't really want to encourage people to run lapis in something like xavante because you're missing out on a lot of the benefites. But the decreased overhead in getting started might be worth it, almost like having it as a beginner mode.

leafo avatar Mar 25 '16 18:03 leafo

I'm thinking of decoupling the server implementation such that you would specify what server implementation to use via the configuration.

Something like server "lapis.nginx" would load a lua module lapis.nginx with callbacks for doing everything necessary with nginx, or lapis.xavante with the xavante implementation. This would make it easy for third party implementations to be separate modules

leafo avatar Mar 25 '16 18:03 leafo

Discussion of that can be continued in #419

leafo avatar Mar 25 '16 19:03 leafo

http://12factor.net/dev-prod-parity best practices here suggest using the same db in production and testing.

vadi2 avatar Mar 28 '16 20:03 vadi2

Definitely, this is more to reduce the barrier to entry to try out lapis, with the goal of attracting new users

leafo avatar Mar 28 '16 21:03 leafo

And for small apps, no? Say one wants a small personal app and doesn't intend on going further with it.

TangentFoxy avatar Mar 28 '16 22:03 TangentFoxy

Yup, that too.

leafo avatar Mar 28 '16 23:03 leafo

Any more thought on this issue? I would really like to use the Lapis model setup for a website I am about to start working on, but I want to use SQLite since this is a smallish, read-only set of data and I feel like using psql is a bit overkill. I have an SQLite Lua module that I can use, but it isn't integrated with the Lapis model.

https://github.com/Wiladams/LJIT2SQLite

karai17 avatar May 28 '16 23:05 karai17

This is pretty decent:

http://lua.sqlite.org/

Gonna see if I can make SQLite3 work with that.

phoenixenero avatar Jun 11 '16 11:06 phoenixenero

Hm. Maybe. I am somewhat partial to the API for the one I linked, though I don't like the PascalCase.

Edit: That one looks like it had a pretty decent API too. I'd say go for it. :)

karai17 avatar Jun 11 '16 11:06 karai17

Okay, the lsqlite3 library supports several features that make it a lot easier to write prepared statements, smarter queries and transaction. I'm gonna have to rewrite the typical approach used by the lapis postgres and mysql abstractions to take advantage of those features, and for better performance.

That would probably make it harder to choose between backends, unless we place an abstraction OVER the lqlite3 library. Which is something I don't want to do.

phoenixenero avatar Jun 12 '16 02:06 phoenixenero

Anyone working on sqlite3 support now?

tpimh avatar Sep 29 '16 01:09 tpimh

not that I'm aware of

leafo avatar Sep 29 '16 02:09 leafo

any progress on this?

Dialga avatar Nov 15 '18 01:11 Dialga

i'd like to try and take a stab at it, however i'm still learning lua, and laravel. I'd like my webcomic to have a lua backend for funzies.

Meleeman01 avatar Jan 13 '19 00:01 Meleeman01

I suspect any code pulled into lapis would be preferred as moonscript over lua. otherwise, any help would be appreciated!

karai17 avatar Jan 13 '19 01:01 karai17

@leafo What steps would be required to integrate SQLITE3? I'm feeling slightly more confident in my abilities and would like to tackle this problem.

TangentFoxy avatar Apr 12 '19 19:04 TangentFoxy

not support sqlite in 2021?

ghost avatar Jan 09 '21 11:01 ghost

it's Oct 2021 now, where is SQLite3 ?

aceyin avatar Oct 20 '21 13:10 aceyin

@aceyin please keep comments on GitHub productive. Politely inquiring about the state of work or providing more context on your use case is a lot more helpful than demanding comments.

turbo avatar Oct 20 '21 13:10 turbo

It's February 2023 and there is now sqlite support

leafo avatar Feb 10 '23 22:02 leafo