Loading...

verticapy.performance.vertica.qprof.QueryProfiler.insert

QueryProfiler.insert(transactions: int | tuple | list[int] | list[tuple[int, int]]) None

Functions to insert new transactions to the copy of the performance tables.

transactions: str | tuple | list, optional Six options are possible for this parameter:

  • An integer:

    It will represent the transaction_id, the statement_id will be set to 1.

  • A tuple:

    (transaction_id, statement_id).

  • A list of tuples:

    (transaction_id, statement_id).

  • A list of integers:

    the transaction_id; the statement_id will automatically be set to 1.

Examples

First, let’s import the QueryProfiler object.

from verticapy.performance.vertica import QueryProfiler

Then we can create a query:

qprof = QueryProfiler(
    "select transaction_id, statement_id, request, request_duration"
    " from query_requests where start_timestamp > now() - interval'1 hour'"
    " order by request_duration desc limit 10;"
)

We can easily insert new transactions:

qprof.insert([(1, 4), (3, 9)])
010
is_current
Boolean
123
transaction_id
Integer
123
statement_id
Integer
Abc
request_label
Varchar
Abc
Varchar(179)
123
qduration
Numeric(9)
📅
start_timestamp
Timestamp(29)
📅
end_timestamp
Timestamp(29)
0
4503599627585131028.4093642024-08-08 16:45:36.6084972024-08-08 16:45:45.012267
Rows: 1-1 | Columns: 9

Note

For more details, please look at QueryProfiler.