plausible / ecto_ch

Ecto ClickHouse adapter
MIT License
77 stars 11 forks source link

Ecto.Adapters.ClickHouse.structure_load: not implemented #37

Closed Zarathustra2 closed 1 year ago

Zarathustra2 commented 1 year ago

Can we support this? I am currently migrating my old clickhouse schema files over and would like to have my old schema in a structure.sql.

Can we not just split on ; and execute every query step by step with the caveat there is no option for a rollback and that it can fail while executing? I feel like this is reasonable for a load operation since one expects the structure.sql to only be loaded once or during ci jobs on clean fresh databases

Zarathustra2 commented 1 year ago

I will look into this then soonish!

Zarathustra2 commented 1 year ago

@ruslandoga I wanted to work on this. How do you set up your dev environement to run command line things such as mix ecto.load?

Do you create a separate app and then just reference your local ecto_ch as dependency?

ruslandoga commented 1 year ago

I don't remember exactly what I did during development, I think I tested the callbacks directly: https://github.com/plausible/ecto_ch/blob/master/test/ecto/adapters/clickhouse/structure_test.exs, and once the tests were passing I did a manual test in plausible/analytics.

Zarathustra2 commented 1 year ago

Ah perfect, I am doing the same right now

ruslandoga commented 1 year ago

History shows that I already had "working" code before adding the tests.

https://github.com/plausible/ecto_ch/pull/17/files

Maybe I used the dev repo: https://github.com/plausible/ecto_ch/blob/master/dev/repo.ex