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

Bump go-sqlite3 library to SQLite3MultipleCiphers 1.8.2 / SQLite3 3.45.0 #821

Merged
merged 8 commits into from
Jan 30, 2024

Conversation

jgiannuzzi
Copy link
Member

This PR bumps up the SQLite3 library to latest version which introduces support for JSONB. The way to use JSON paths has also changed (it looks like the way we used them before was not supposed to work in the first place) so this required changing a couple of things in the code.

Once this PR is merged, we should consider using JSONB for contexts instead of the current JSON implementation.

@jgiannuzzi jgiannuzzi self-assigned this Jan 22, 2024
@jgiannuzzi jgiannuzzi added the enhancement New feature or request label Jan 22, 2024
@@ -59,7 +59,7 @@ func BuildJsonCondition(
conditionTemplate = "%s->>? = ?"
idx := 0
for k, v := range jsonPathValueMap {
args[idx] = k
args[idx] = fmt.Sprintf("$.%s", k)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this would require some other changes in the query module -- particularly in query.go, clause.go, query_test.go, etc

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for letting me know! could you please elaborate on the required changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

for instance, the query parser is not supplying the '$.' prefix for keys, https://github.com/G-Research/fasttrackml/blob/main/pkg/api/aim/query/query_test.go#L283-L298

But the integration tests which depend on it are still passing. So I think it must be optional?

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Maybe we should just make this change (and adjust query_test.go accordingly)?

Copy link
Contributor

@suprjinx suprjinx Jan 25, 2024

Choose a reason for hiding this comment

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

perhaps add the '$.' unless already present (assuming users could provide well-formed json path inputs)?

dsuhinin
dsuhinin previously approved these changes Jan 23, 2024
@@ -84,7 +84,7 @@ func TestBuildJsonCondition(t *testing.T) {
"key2.nested": "value2",
},
expectedSQL: "contexts.json->>? = ? AND contexts.json->>? = ?",
expectedArgs: []interface{}{"key1", "value1", "key2.nested", "value2"},
expectedArgs: []interface{}{"$.key1", "value1", "$.key2.nested", "value2"},
Copy link
Contributor

Choose a reason for hiding this comment

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

For instance, this isn't the only test where we are looking at the args created by query.go -- there are a few cases in query_test.go that test the json key argument. I'm a little surprised this doesn't break more tests ... I can try out your branch, maybe the $. prefix is optional

@jgiannuzzi jgiannuzzi removed their assignment Jan 29, 2024
fabiovincenzi
fabiovincenzi previously approved these changes Jan 30, 2024
Copy link
Collaborator

@fabiovincenzi fabiovincenzi left a comment

Choose a reason for hiding this comment

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

LGTM

@suprjinx suprjinx merged commit 84ae333 into G-Research:main Jan 30, 2024
17 checks passed
@jgiannuzzi jgiannuzzi deleted the update-sqlite3mc branch February 13, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants