SQL Options

Run different SQL queries.

Using node/bun:

import datasquirel from "@moduletrace/datasquirel";

datasquirel.api
    .sql({
        key: process.env.FULL_ACCESS_API_KEY,
        params: {
            database: "social_network",
            sql: "SELECT * FROM users where email like ?",
            values: ["@example.com"],
        },
    })
    .then((response) => {
        console.log(response);
    });

Using curl:

CURL -X OPTIONS https://datasquirel.com/api/v1/sql/social_network \
-H "Authorization:FULL_ACCESS_API_KEY"
-H "Content-Type: application/json" \
-d '{ "sql": "SELECT * FROM users where email like ?", "values": ["@example.com"] }'


Return Response:

{
    success: true,
    payload: [
        {
            id: 1,
            name: "John",
            email: "[email protected]",
        },
        {
            id: 2,
            name: "Jane",
            email: "[email protected]",
        },
    ],
    "queryRes": {
        "string": "SELECT * FROM users where email like ?",
        "values": ["@example.com"]
    }
}