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

DMLs are not returning an output while iterating the result using the conn.queryStream() iterator #293

Open
alealealedocebo opened this issue Sep 19, 2024 · 2 comments

Comments

@alealealedocebo
Copy link

alealealedocebo commented Sep 19, 2024

Hi all,

if I run an "UPDATE ..." query and I run it using the .queryStream method and I try to iterate the returned rows, the iterator doesn't return the result.

I'm using the for await (const elm of conn.queryStream()) { ... } syntax for this. Apparently, the code never enters the cycle and the execution goes ahead, meaning that the AsyncGenerator's Promise is indeed resolved as the query's execution ends.

While it does if the query is a DDL. I'm using .queryStream() over a connection borrowed from the connection pool, as the documentation suggests.

Instead, when I was using mysql2 in the past, I could get the same output that I can get using the mysql cli. Something like this:

Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

Can you help me to obtain the same behaviour on this connector?

Thank you

@rusher
Copy link
Collaborator

rusher commented Sep 20, 2024

There is indeed a difference in behavior compared to mysql2.
Just a question: why using streaming on a command that will have only one result ? streaming is to avoid loading lots of data into memory for big query.
anyway, I'll add that for compatibility.

@alealealedocebo
Copy link
Author

Your suggestion makes definitely sense and I've already provided to implement it while we wait for this improvement to ship!

Thank you @rusher

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

No branches or pull requests

2 participants