Teradata/jaqy

How to hide the part of output?

Closed this issue · 7 comments

lij55 commented

It is an excellent tool for interactive work with database. I want to run some tests with script. The script has .repeat and .timer. The output looks like:

-- success. update count = 3
-- iteration: 7
-- success. update count = 3
-- iteration: 8
-- success. update count = 3
-- iteration: 9
-- success. update count = 3
-- iteration: 10
-- success. update count = 3
-- 3/1 - 0 ----------------------------------------------------------------
.timer
-- timer: 00:00:00.015165268
-- 3/2 - 0 ----------------------------------------------------------------

Is it possbile to hide the --iteration and --success output and keep --timer only?

Currently, there is no way. These are intentionally generated so that if there is an issue at a particular iteration you can go back to it / reproduce it.

Backtrack previous statement.

There needs to be a new command to hide such such message. I will think about it. .quiet is not good one since it hides the results. If you can help me thinking up a command name, that would be great too.

Add the ability to customize the iteration message.

However, I need to think about how to avoid empty lines. This is an oversight in the original design. That is, if the user wants to completely avoid success/update/iteration prompt, there is no way. They can create handlers in javascript that returns empty string, but a newline '\n' is still being printed.

See https://github.com/Teradata/jaqy/blob/master/tests/unittests/commands/script_4.sql for an example of how to customize the handlers.

I will not make a new build for now. You will need to create a build yourself.

lij55 commented

Thanks for the quick action! I will test it.

Please pull again to get the last commit to fix the restoration issue. Unfortunately I was multitask quite a few things and did not notice the unit test was incomplete. Anyways, there was a minor issue with restoring the iteration handler that should be fixed with the last commit.
Then again, there is no guarantee that it will work 100% since I just had a lot of beer :)

The commit ace48e8 added .handler none as one way to hide all handlers. Use .handler default to reset to default.