SQL-history: save narrative of selected-group of queries with result-sets
started a topic
almost 8 years ago
[This topic is migrated from our old forums. The original author name has been removed]
SQL-History - show interleaved query+resultset option , multiple queries+results saved to single file.
The docs say:
"As you execute SQL statements in the SQL Commander, DbVisualizer saves them as History entries, along with information about the Connection, Catalog, Schema and the execution result."
I thought this phrase "execution result" might include the result-set from queries, but it seems not the case.
Currently (v8.0.10) the SQL-history does not show result sets
for a previously successfully-executed particular query, and separates the individual
queries into discrete 'files' when saved via 'Save the
current context to a named file'. That is to say you
cannot select a group of rows in SQL-history and do a single 'Save'
action (when you select 2 or more rows, the Save button gets disabled).
Could we have an optional feature, that would
(a) allow saving a selected-group of SQL-history queries
into a single file, with timestamp information about when they ran AND
(b) for that single-file to *also* include the result-set(s)
if any, that resulted from each query, appearing after the query text,
along with the elapsed time per query, and (possibly truncated)
This is intended to help with time-sensitive research (e.g.
for a data issue or such like problem) , where the result-set(s)
from a whole sequence of queries/procedures needs to be automatically saved along
with (preferably following) the query that produced them, in a
sequence from start to finish.
For example, when examining a potential data issue I may need
to make a series of queries, each one producing a result-set
and the contents of the result-set determines the next ad-hoc query
that I might make. What I'm seeking is a log-file that contains
both the queries and their (small) result-sets, in the time order thay
they got executed, along with (header/trailer) timestamp
when the query executed and its duration(elapsed). The idea is that I can
then post that log file to a person who can determine the
issue by simply following the log file (but who might not
be able to re-run the queries, or might re-run them but
get a different result due to time sensitive nature of data etc).
So it would behave just like a log of a 'screen' bash session in Linux
or a copy/paste of an entire command-line session in db2cmd on Windows.
Perhaps there is a simple way to achieve this in the current v8.0.10 version but I do not know a quick and easy way to do it (I think it should not be the default behaviour however).
almost 8 years ago
[This reply is migrated from our old forums.]
Re: SQL-history: save narrative of selected-group of queries with result-sets
The execution result in the SQL history context is the result of the executed SQL in terms of execution time, affected rows, successful/fail, etc. It doesn't keep any result sets.
I understand from what you are requesting that it is a specialized scenario that I don't believe will fit that well in the SQL history feature.
To partially achieve what you are looking I suggest you check the @export client side command (and possibly other @ commands). It is used to re-direct the result of queries to files along with optional header that show the SQL generating the result set. This is the closest I can think of at the moment even though I believe it is not exactly what you are looking for.
Read more about the @export command in:
We do have a request for adding a auditing feature in DbVisualizer. The purpose with this is to log every SQL being executed, both those executed in the SQL Commander and also all internal SQLs executed by DbVisualizer. I will add your request that this should also (optionally) save result sets.