shuttle-hq / synth

The Declarative Data Generator
https://www.getsynth.com/
Apache License 2.0
1.39k stars 109 forks source link

Support SQLite #161

Open rasviitanen opened 3 years ago

rasviitanen commented 3 years ago

Required Functionality I use sqlite in some projects and would like to be able to use synth in these projects as well.

Something like this is what I am looking for:

synth import gen --from sqlite://real.db3
synth generate gen --to sqlite://generated.db3

Proposed Solution I think this can be done by leveraging the already existing sqlite support in sqlx. I did a very rough implementation here: https://github.com/rasviitanen/synth/commit/938976b3efc982060d586ab80447d9a02c1bfccd to show that it requires a minimal effort.

Obviously the implementation needs cleaning up (I copied the MySql implementation and tweaked it until import/generate worked for the db I have). But it shows a rough idea about how this could be implemented.

If you are interested I would be happy to spend some more time on this and make a more refined implementation. But I understand if you dont want to add extra complexity by introducing another db at this stage.

Use case I have a bunch of very complex sqlite-files with real user data. I want to be able to generate files similar to these by using synth.

christos-h commented 3 years ago

Hey @rasviitanen ! I looked at the linked commit and it looks great!

SQLite support is very much on the roadmap, so it's great that you're working on an implementation - if you are interested in seeing it all the way through I'd be more than happy to merge it. If you need any help please do let me know.

I'll assign you on this one. Really excited to get this merged in!

christos-h commented 3 years ago

Hey @rasviitanen - would you like me to finish your sqlite work and push it over the line?

rasviitanen commented 3 years ago

@christoshadjiaslanis Hey, thanks for asking. I have been incredibly busy since I posted this, but I have started to look at this again and will try to wrap it up during the weekend. Hopefully the next update is a PR, otherwise I'll let you know what the status is.