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

Raw Query Dump #13

Open
DanielHe4rt opened this issue Mar 25, 2024 · 2 comments
Open

Raw Query Dump #13

DanielHe4rt opened this issue Mar 25, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@DanielHe4rt
Copy link
Contributor

Hey Goran!

There's any way to dump the raw query before it get executed for debugging purposes?

@GoranBrkuljan
Copy link
Member

GoranBrkuljan commented Mar 26, 2024

ATM we can do it for insert, update and delete queries by doing following:

let caching_session: CachingSession;

let res = model.insert().trace(true).execute(caching_session).await?;
if let Some(tracing_id) = res.tracing_id {
    let info = caching_session
        .get_session()
        .get_tracing_info(&tracing_id)
        .await
        .unwrap();
    // log query
    info!("Info: {:#?}", info.parameters);
}

For read queries we return typed results, so we would need to update our CharybdisQuery execution logic to enable this. I will do it when I get a chance, so let's leave this thread open for now.

@GoranBrkuljan
Copy link
Member

Additionally, in case of error you can also cover read query by printing CharybdisError as it always print static query that is generated at compile time, however it does not contain values.

@GoranBrkuljan GoranBrkuljan self-assigned this Apr 17, 2024
@GoranBrkuljan GoranBrkuljan added the enhancement New feature or request label May 4, 2024
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

No branches or pull requests

2 participants