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

Logging the data being updated in Verify Step #257

Closed
kamalsivalingam opened this issue Mar 14, 2022 · 7 comments · Fixed by #263
Closed

Logging the data being updated in Verify Step #257

kamalsivalingam opened this issue Mar 14, 2022 · 7 comments · Fixed by #263

Comments

@kamalsivalingam
Copy link

Hi,

We are using Postgres DB and was trying to integrate Yuniql for data deployment in Azure DevOps. Looks like its working as expected.
However I was wondering if there is a way to log the actual data being updated in Verify step. We use "RETURNING *" at the end of the query to show the data after update. It would be nice to see the results, so we can stop the deployment in case its unintentionally updating lot/all records.

Thanks!

@rdagumampan
Copy link
Owner

Hi @kamalsivalingam thanks again for the feedback. I have looked into the code and what are the possibilities. As I understand it, you want the results to be printed out into the CLI after each SQL statement is executed. This feels incredibly complex to implement and might not be possible to support in all other platforms. I know for SQL Sever, we can return the data also after insert/update because it maintains a cache table with reserved name INSERTED and UPDATED and this requires implementing a generic data reader that can support whatever table schema.

I so far cannot think of any work around to support you on this. A possibility might be just print out the record count affected after every statement.

@kamalsivalingam
Copy link
Author

@rdagumampan Yes, I think just the record count would itself be great. This way, as part of the validate step, we would know how many records are being updated before we run the actual query

@rdagumampan
Copy link
Owner

@kamalsivalingam, in practice I would not use yuniql verify in production. This is primarily because it relies on the ability of the database platform's transaction log, connection time out and reliability of your network. If the scope of change is big and big transaction log is created to support rollback, it can make your production database unpredictable and subject to unknown side effects.

Instead, I suggest using staging/preprod/replica database to isolate the verification runs.

@pwilliams906
Copy link

A possibility might be just print out the record count affected after every statement.

Just to verify: right now, even if scripts "print" (or equivalent) information during the execution of a script, yuniql isn't sending that to stdout, correct? At least with sqlserver, that's been my experience: "throw" messages will make it to the output/log, but "print" doesn't.

@rdagumampan
Copy link
Owner

@kamalsivalingam, excuse for the delay, got some good time while its Easter off in EU. Here's how it's going to look like in the next release. This fix will also will be available in the nightly build. Watch this issue and will comments when its ready to use. Thanks for reaching out!

image

@pwilliams906, yuniql is not subscribing to events coming out of the sql/odbc driver. In this feature, we're just counting the record count affected by the sql statement or batch of sql statement. For SQL Server, the PRINT command is exclusively for use when running scripts in SSMS Query Analyzer afaik. HTH

@kamalsivalingam
Copy link
Author

@rdagumampan Awesome, this is great. Thanks for considering the suggestion and getting it integrated!

@rdagumampan rdagumampan self-assigned this Apr 18, 2022
@rdagumampan rdagumampan added this to the v1.3 milestone May 21, 2022
@rdagumampan
Copy link
Owner

Closed. Released in v1.3.10.
https://github.com/rdagumampan/yuniql/releases/tag/v1.3.10

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

Successfully merging a pull request may close this issue.

3 participants