sqlite_ecto icon indicating copy to clipboard operation
sqlite_ecto copied to clipboard

Can't use sqlite_ecto with latest Phoenix framework

Open markokocic opened this issue 8 years ago • 15 comments

sqlite_ecto doesn't work with latest ecto version shipped with Phoenix Framework 1.3 due to dependency resolution problems.

markokocic avatar Jun 28 '16 07:06 markokocic

Looking at the ecto project, it claims that sqlite_ecto is not compatible with ecto 2.0. phoenix_ecto needs ecto version 2.0.0-rc, while sqlite_ecto requires version 1.1. I don't know how hard it is to update sqlite_ecto to support the latest version of ecto .

sprobstCocus avatar Jun 29 '16 07:06 sprobstCocus

same problem here. not just ecto2, but also with posion2.

HughGrant avatar Jul 01 '16 11:07 HughGrant

Does this project have a plan or roadmap to support Ecto 2.0? It's like a hard requirement for long-term use of this project.

hayesgm avatar Aug 07 '16 22:08 hayesgm

Hmm yeah.. this is really hurting adoption / learning of ecto/phoenix. Not really interested in setting up an SQL server for testing purposes.

kentor avatar Sep 08 '16 16:09 kentor

Yeah and for nerves-project :( Dont want to install any DB on embedded.

philipgiuliani avatar Sep 08 '16 16:09 philipgiuliani

How much effort will be it to make this project Ecto 2.0 compatible? Probably worth the effort to tag out the work effort and just move on it. I think this is too important to just ignore.

hayesgm avatar Sep 08 '16 18:09 hayesgm

any updates?

gallexme avatar Sep 23 '16 16:09 gallexme

I have been working on adding ecto 2 support over the weekend. Got the basics working already, just need to fix a bunch of integration tests. Hope to have a PR ready in the next few days.

obmarg avatar Sep 25 '16 22:09 obmarg

Thank you very much for your work @obmarg! You already have it on git so i can try it out?

philipgiuliani avatar Sep 26 '16 06:09 philipgiuliani

@philipgiuliani I've pushed up a WIP commit to the feature/ecto-2.0 branch of my fork: https://github.com/obmarg/sqlite_ecto/tree/feature/ecto-2.0

I can't guarantee it's particularly usable right now: the project I've been testing it against has fairly minimal usage of ecto, and the integration tests are failing before they even start. Feel free to give it a try though.

obmarg avatar Sep 26 '16 11:09 obmarg

@jazzyb any thoughts on this?

alakra avatar Sep 26 '16 16:09 alakra

@obmarg Could you also update Poison to 2.0? The sqlite_ecto requires ~> 1.0.0 and my project requires ~> 2.0.0. Ecto itself requires ~> 1.5 or ~2.0.

So far it seems to work fine. I have tested to create migrations, migrate and insert/read data from tables. But without associations yet.

I also noticed that :sqlitex, :db_connection have to be added in applications. Otherwise exrm will not add them to the release.

philipgiuliani avatar Sep 26 '16 17:09 philipgiuliani

I think to use SQLite with Ecto 2 we will need to switch to a port_driver based API, instead of NIF because DBConnection is designed around multi process port access and wants to be able to close the the "connection" while another process is running a query and to close the "connection" when the DBConnection process exits. This would mean replacing sqlitex with a different SQLite implementation.

https://github.com/alexeyr/erlang-sqlite3 seems like a reasonable candidate. Likely we would want to fork it and replace rebar with mix, and the Erlang code with Elixir.

fishcakez avatar Nov 12 '16 18:11 fishcakez

@fishcakez I'm not sure I follow, how does Sqlitex being implemented with NIFs prevent DBConnection from closing "connections"?

I've got an incomplete DBConnection implementation for Sqlitex, is there something obvious I'm missing in there?

obmarg avatar Nov 13 '16 14:11 obmarg

@obmarg I am concerned about the Ecto 2.0 style timeouts and error handling. Ecto 2.0 timeouts require the "connection" to be closed by DBConnection while the caller is running queries, which interrupts the caller. I am unsure how that can be achieved with a NIF. In the code you linked it looks like this doesn't happen but please correct me if I am wrong. With a port_driver we can close the port. With Ecto 2.0 timeouts are per ownership and per transaction - different to Ecto 1.0.

fishcakez avatar Nov 13 '16 15:11 fishcakez