Docs Menu
Docs Home
/
Relational Migrator
/ / /

Compare Converted Queries

On this page

  • About this Task
  • Before you Begin
  • Steps
  • Learn More

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.

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.
  • 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.

1
  1. 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.

  2. On the left-hand Queries pane, select a query, view, or stored procedure.

  3. If your query has not been converted, select a Target Language and click Convert .

2
  1. From the Code Generation tab, click the Query Converter pane.

  2. On the bottom-right of the screen, click the button.

3

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;
$$
4
  1. On the Test Queries pane, click the Run Source Query button.

  2. Enter the connection details to your source database.

  3. 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.

5
  1. On the Test Queries pane, click Run Converted Query button.

  2. Enter the connection details to your database.

  3. On the Connection Details form, click Run.

    The data from the destination database populates on the right-side of the Results user interface.

  4. 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.

6

If the destination query needs to be changed, you can make code changes in the Converted MongoDB Query pane and run the updated query.

  1. On the Converted MongoDB Query pane, click the button.

  2. Edit the code and click Save.

  3. Click Run Converted Query.

Back

Install Query Runner