-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Used Prepared Statements for GetChannel in clickhousereader #1414
Conversation
Welcome to the SigNoz community! Thank you for your first pull request and making this project better. 🤗 |
We would appreciate it if you could provide us with more info about this issue/pr! |
@jshiwam How prepared statements are useful here? |
@makeavish yes you are right in this case it is not that useful. What I understood from the issue is that any query that uses an args needs to be moved to prepared statement. If this is not required then I will remove it and make the other changes. |
Got it, I didn't see the issue: #1353 |
@makeavish there are other functions that has to be changed according to this issue, should I wait for the feedback until this PR gets merged or this will be open and should I add the other changes incrementally on the same PR?. Just want to make sure the testing at your end is easier. How are we gonna go about it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using transaction here seems like an unnecessarily complication to me. You would generally use transaction for in case of mutation like CREATE
, UPDATE
etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change can something simple like this.
stmt, err := r.localDB.Preparex(`SELECT id, created_at, updated_at, name, type, data data FROM notification_channels WHERE id=?`)
err = stmt.Get(&channel, idInt)
Yeah I was not sure whether to use transactions or not but used it in this case. Will make the changes and submit the PR. |
Kudos, SonarCloud Quality Gate passed!
|
@srikanthccv made the suggested changes. Please confirm. I might have to squash the commits. Did some rebasing and resolved many conflicts. |
Added prepared statements for GetChannel(id string).