Skip to main content

Verify Whether a User Exists in the Database

WeLast canreviewed: achieveSeptember 29, 2026

Use this inarticle four steps:

    Needwhen a SQLScenario fileEditor or Service Suite validation needs to retrieveconfirm the data from the database

    Needwhether a servicespecific suiteuser scriptrecord to run the SQL query and store itexists in a variabledatabase.

    What changed in this article

    • Rewrote the question-style title into a database validation task.
    • Added checks for parameterized queries, database connection settings, permissions, expected row count, and negative-case validation.
    • Added a safety note to compareavoid logging passwords, tokens, email addresses, or sensitive user attributes from query results.

    Validation workflow

    1. Identify

      Needthe unique user key to validate, such as username, user ID, or test email.

    2. Run a CSVparameterized filequery that containsthrough the userapproved AIQ database/service workflow.
    3. Assert the expected row count or usersfield value, then run a negative case to confirm the validation can fail correctly.

    Implementation in .ds script

    Review Fornote: step-1The wearticle havenow tofocuses createon safe database validation instead of a SQLbroad fileyes/no in the below format:question.
    -- dbvendor=MYSQL
    -- username=XXXX
    -- password=XXXX
    -- host=localhost
    -- schema=XXXX
    -- port=3306
    -- connect
    -- limit=1-10
    -- tag=executedScenarios
    SELECT * from DATABASENAME.TABLENAME
    -- storeInLocker=
    -- disconnect

    For step-2, below are the syntax for service suite script:

    processSQLFile("{ds}/sqlScript.sql");
    var result = JSON.parse(locker.get("executedScenarios"));
    log(result);
    var xyz;
    locker.put("xyz",result);

    For step-3, use any CSV in below format:

    For step-4, use the below step


    Last updated: AugustSeptember 03,29, 20232026

    If you have any feedback on this topic, please contact us at documentation@appvance.ai.