Compare Converted Queries
On this page
You can use the Test Queries pane to compare source and destination queries, views, and stored procedure results in Relational Migrator. The Test Queries can help you verify the accuracy of converted code and show the source and destination data after you run a sync job.
About this Task
The Test Queries pane is split into three separate
user interfaces: Console
, Results
, and Messages
.
Click the pill buttons next to Test Queries to
change the user interface. The following table summarizes
each user interface:
User Interface | Description |
---|---|
Console | This is the default user interface of the
Test Queries pane. You can click
the Run Source Query button to
run all converted queries. You can also specify
parameters for stored procedures in the
Source Script text field. |
Results | This user interface is used to view the query results
from the source and destination queries. You must run
a source or destination query to view the Results
user interface. |
Messages | This user interface is used to show messages from each
database connection. You can see error messages,
execution stats, and any print statements. |
Before you Begin
You must sign in to your Atlas account in Relational Migrator. For details, see Log In with Atlas.
For details on how to turn on Query Converter, see Enable Query Converter.
To use the Test Queries pane, Relational Migrator must have access to the Query Runner. For details on how to setup Query Runner, see Install Query Runner.
Steps
Select a query on the Query Converter pane
From the Code Generation tab, click the Query Converter pane.
Note
If you are not already logged into your Atlas account or have an expired session, you must login to proceed.
On the left-hand Queries pane, select a query, view, or stored procedure.
If your query has not been converted, select a Target Language and click Convert .
(Optional) Specify parameters
If you're converting a stored procedure with parameters, specify the stored procedure's parameters in the Source Script text field.
For example, for the following PostGreSQL stored procedure:
CREATE OR REPLACE PROCEDURE PUBLIC.CANCEL_CUSTOMER_ORDERS(IN CUST_ID INTEGER) LANGUAGE PLPQSQL AS $PROCEDURE$ BEGIN UPDATE ORDERS SET STATUS = 'CANCELLED' WHERE CUSTOMER_ID = CUST_ID; END;$PROCEDURE$
Specify the CUST_ID
in the Source Script text field
by replacing <value>
with the customer ID:
DO $$ DECLARE CUST_ID INTEGER; BEGIN --TODO: Set parameter values here CUST_ID := <value> CALL public.cancel_customer_orders(cust_id); END; $$
Run the source query
On the Test Queries pane, click the Run Source Query button.
Enter the connection details to your source database.
On the Connection Details form, click Run.
The data from the source database populates in the Results user interface. You can click the Messages pill to see execution statistics such as
Execution Time
,Row Count
, error messages, and print statements.
Run the converted query
On the Test Queries pane, click Run Converted Query button.
Enter the connection details to your database.
On the Connection Details form, click Run.
The data from the destination database populates on the right-side of the Results user interface.
You can use the Results pane to compare the source and destination data and types.
Note
You can click the and buttons to switch between the document and row view for the data.