Basics
SQL Queries
SQL is the standard language for interacting with relational databases. In QuymnyDB you send the same queries you'd run locally with xampp, mysql, postgres or any other SQL database — they just execute against your cloud database.
Common query patterns
-- Create database
CREATE DATABASE mychool;
-- Employees table
CREATE TABLE employees (
employee_id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE,
phone VARCHAR(20),
job_title VARCHAR(100),
salary DECIMAL(10,2),
hire_date DATE
);
QuymnyDB Shell
Use the QuymnyDB shell to run SQL queries directly against your cloud database. The shell provides a convenient interface for executing queries and managing your database schema. In this shell you don't need to run queries such as USE database_name — once you are in the database name displaying at the header, it's automatically the current database you are working on.
Error Handling
If you type a query incorrectly, the shell won't display an error message indicating the issue. Make sure the related data you are trying to run the query against is available in the database, and that you are typing the query correctly. This is mostly the case when altering, dropping, or inserting data into a table or database — if the table or database is not available in the current database, the shell will show an error. But once you type your queries correctly and the related data exists, the shell will execute the query successfully and display the result.
Setup
Connecting to Database
Grab your QuymnyDB connection URL and token key from the dashboard, then open a connection.
JavaScript
import { QuymnyDB } from "quymnydb";
const db = new QuymnyDB({
url: "https://qdb-worker.quymny.com/execute-sql",
tokenKey: "YOUR_TOKEN_KEY"
});
await db.connect();
console.log("Connected ✓");
Tip: keep the token key server-side. Never ship it in a browser bundle.
Python
from quymnydb import QuymnyDB
db = QuymnyDB(
url="https://qdb-worker.quymny.com/execute-sql",
token_key="YOUR_TOKEN_KEY"
)
if db.connect():
print("Connected ✓")
Write
Sending data
Batch inserting rows enables single-query execution for multiple records, significantly reducing HTTP network latency, minimizing database overhead, and boosting overall data ingestion throughput across high-performance web applications.
Python
# INSERT Multi-row
multi_row = db.execute("""
INSERT INTO test_departments (id, name)
VALUES (2, 'Design'), (3, 'Database'), (4, 'Management');
""")
print_json("Multi-row INSERT result", multi_row)
JavaScript
const multiRow = await db.execute(`
INSERT INTO test_departments (id, name)
VALUES (2, 'Design'), (3, 'Database'), (4, 'Management');
`);
console.log("Multi-row INSERT result:", multiRow);
Transactions
Data commit
Transaction batching bundles setup commands, parameterized insertions, and commit instructions into a single HTTP request, guaranteeing ACID compliance, atomic operations, and eliminating sequential network round-trips for multi-step updates.
Python
# -------------------------------------------------------
# TRANSACTION - COMMIT (SINGLE HTTP REQUEST)
# -------------------------------------------------------
try:
tx_ops = [
"BEGIN",
("INSERT INTO test_users (id, name, email, department_id, salary, active) VALUES (%s, %s, %s, %s, %s, %s)", [7, "Grace", "grace@example.com", 1, 88000, 1]),
("INSERT INTO test_posts (id, user_id, title, body) VALUES (%s, %s, %s, %s)", [4, 7, "Grace's Post", "Created inside a transaction"]),
"COMMIT"
]
# Map to arrays: strings get None for params, tuples get their query and params
q_arr = [op if isinstance(op, str) else op[0] for op in tx_ops]
p_arr = [None if isinstance(op, str) else op[1] for op in tx_ops]
db.execute(q_arr, p_arr)
print("Transaction committed successfully!")
except Exception as err:
print(f"Transaction commit failed: {err}")
JavaScript
try {
const txOps = [
"BEGIN",
["INSERT INTO test_users (id, name, email, department_id, salary, active) VALUES (?, ?, ?, ?, ?, ?)", [7, "Grace", "grace@example.com", 1, 88000, 1]],
["INSERT INTO test_posts (id, user_id, title, body) VALUES (?, ?, ?, ?)", [4, 7, "Grace's Post", "Created inside a transaction"]],
"COMMIT"
];
const qArr = txOps.map(op => typeof op === 'string' ? op : op[0]);
const pArr = txOps.map(op => typeof op === 'string' ? null : op[1]);
await db.execute(qArr, pArr);
console.log("Transaction committed successfully!");
} catch (err) {
console.error("Transaction commit failed:", err);
}
Read
Data retrieval
Query execution retrieves structured relational data via SQL constructs like LEFT JOIN to highlight orphaned records, returning results in lightweight, predictable JSON structures without requiring complex ORM overhead.
Python
null_test = db.execute("""
SELECT d.name AS department, u.name AS user_name
FROM test_departments d LEFT JOIN test_users u ON d.id = u.department_id
WHERE u.id IS NULL;
""")
print_json("Departments without users", null_test)
JavaScript
const nullTest = await db.execute(`
SELECT d.name AS department, u.name AS user_name
FROM test_departments d LEFT JOIN test_users u ON d.id = u.department_id
WHERE u.id IS NULL;
`);
console.log("Departments without users:", nullTest);
Pricing
Free Database Tier
Get started for free with generous quotas designed for side projects, prototypes, and lightweight production workloads.
- Up to 10 Databases
- 500M Queries / Month / database
- 0.5 GB Storage
- 100 GB Bandwidth
Databases aren't lost when you change your plan, but the number of databases you can create is limited by your plan. If you downgrade to a plan with a lower database limit, you won't be able to create new databases until you delete some existing ones or upgrade your plan. For example, if you are on the Standard plan and your account is downgraded, only the first 10 databases will remain active. The other 180 databases will remain inactive and won't be accessible via URL or token until you upgrade your plan or delete some existing databases. The same applies to the Pro plan if your account is downgraded to the Free plan.
Need help? Contact us to discuss your requirements.