Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support sqlite #185

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

rasviitanen
Copy link

@rasviitanen rasviitanen commented Oct 3, 2021

Adds support for sqlite.

closes: #161

Todo

  • A test harness - we should proabably create a test harness at synth/testing_harness/sqlite. But here we don't have to run docker, so question is if we want something else?
  • The random sampling does not work as intended as sqlite's random doesn't support a seed.
  • I would like to add some tests for fetching column names etc from sqlite to make sure they work as intended. But I was not sure how you want to structure these tests. Maybe it's sufficient witht he test harness.

Other

  • I had some issues when generating to an empty directory, so I added support for this [commit !85ca11b]
  • I had some issues where I had low=Bound::Included(1) and high=Bound::Excluded(1). To me it feels natural that this range includes a number 1, so I added some code for this [commit !8ba84fa]. It also includes the number if you have low=Bound::Excluded(1) and high=Bound::Included(1), I am not equally sure about this case though.

I can drop these two commits if they are not desired.

@rasviitanen
Copy link
Author

@christoshadjiaslanis please take a look. If you want to take it over it's fine by me 😃
Otherwise I'll take a look at the remaining things and feedback next time I get some time over.

@christos-h
Copy link
Member

christos-h commented Oct 6, 2021

@rasviitanen thank you for this it looks great! I'll happily take it over the line from here.

I think the deterministic sampling is a prerequisite for the testing harness (if we stick to the golden master strategy we have for other datasources).

Regarding the bounds - I think they're breaking some tests. I'm not sure I understand why this felt unnatural - perhaps you could elaborate?

Regarding generating into an empty directory - I think that's a great idea so thank you!

@rasviitanen
Copy link
Author

rasviitanen commented Oct 7, 2021

@christoshadjiaslanis Thanks!

I guess the bounds issue originates from synth generating an empty bounds set (Included(x), Excluded(x)) if I only have a single item in the table I am importing from. With this, the generation returns an error as the range is empty. Maybe the issue is that synth generates an empty range in this case instead of some constant. (Included(x), Excluded(x)) should indeed be an empty range, so idk what I was thinking when changing this. Should have looked at the root cause instead.

@@ -137,9 +138,9 @@ impl Cli {
self.store.save_collection_path(&path, collection, content)?;
Ok(())
}
} else if self.store.ns_exists(&path) {
} else if self.store.ns_exists(&path) && !self.store.ns_is_empty_dir(&path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SQLite
3 participants