{"id":41689,"library":"orma","title":"Orma","description":"Orma is a JSON-based, statically typed query language for SQL databases that converts parsable, serializable, and type-safe JSON syntax into SQL strings. It supports MySQL, PostgreSQL, and SQLite, offering features like validation, multi-tenancy, database introspection, declarative foreign keys, nested queries and mutations, mixed operations, dynamic types, batching, and query planning. Version 1.0.282 is the current stable version, with frequent releases. Unlike other ORMs, Orma is pure JS with no code generation and allows use of your own database connector.","status":"active","version":"1.0.282","language":"javascript","source_language":"en","source_url":"https://github.com/mendeljacks/orma","tags":["javascript","orm","database","mysql","postgresql","declarative","typescript"],"install":[{"cmd":"npm install orma","lang":"bash","label":"npm"},{"cmd":"yarn add orma","lang":"bash","label":"yarn"},{"cmd":"pnpm add orma","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; named import","wrong":"const orma_query = require('orma').orma_query","symbol":"orma_query","correct":"import { orma_query } from 'orma'"},{"note":"ESM-only; named import, not default","wrong":"import orma_mutate from 'orma'","symbol":"orma_mutate","correct":"import { orma_mutate } from 'orma'"},{"note":"ESM-only; named import","wrong":"const { get_mutation_diff } = require('orma')","symbol":"get_mutation_diff","correct":"import { get_mutation_diff } from 'orma'"},{"note":"Exact name; no camelCase conversion","wrong":"import { mysql2Adapter } from 'orma'","symbol":"mysql2_adapter","correct":"import { mysql2_adapter } from 'orma'"},{"note":"ESM-only; named import, not default","wrong":"import ormaSchema from 'orma'","symbol":"orma_schema","correct":"import { orma_schema } from 'orma'"}],"quickstart":{"code":"import { orma_query, orma_mutate, get_mutation_diff, mysql2_adapter, orma_schema } from 'orma';\nimport mysql from 'mysql2';\n\nconst pool = mysql.createPool({\n  host: process.env.DB_HOST ?? 'localhost',\n  port: parseInt(process.env.DB_PORT ?? '3306'),\n  user: process.env.DB_USER ?? 'root',\n  password: process.env.DB_PASS ?? '',\n  database: process.env.DB_NAME ?? 'test',\n  multipleStatements: true,\n}).promise();\n\nconst ormaSql = mysql2_adapter(pool);\n\nconst query = {\n  users: {\n    id: true,\n    first_name: true,\n    email: true,\n    posts: {\n      id: true,\n      title: true,\n      views: true\n    }\n  }\n};\n\nconst results = await orma_query(ormaSql, query, orma_schema);\nconsole.log(results);\n\n// Mutation example\nconst mutation = {\n  users: {\n    create: [\n      { first_name: 'Jane', email: 'jane@example.com' }\n    ]\n  }\n};\nconst diff = get_mutation_diff(mutation, results);\nawait orma_mutate(ormaSql, diff, orma_schema);","lang":"typescript","description":"Shows querying users with their posts and creating a new user using Orma's JSON syntax with mysql2 adapter."},"warnings":[{"fix":"Set `multipleStatements: true` in your pool configuration.","message":"Orma requires the database connection to have `multipleStatements: true` enabled.","severity":"breaking","affected_versions":">=0.1"},{"fix":"Use named imports like `import { orma_query } from 'orma'`.","message":"All imports are named, not default. Attempting default import will result in undefined.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use `pool.promise()` to get the promise-based interface.","message":"The mysql2_adapter function must be called with a promise-based pool; callback-style pool will not work.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'1.0.282':59 'allow':80 'base':7 'batch':54 'code':77 'connector':86 'convert':16 'current':62 'databas':14,41,85,89 'declar':43,92 'dynam':52 'featur':35 'foreign':44 'frequent':66 'generat':78 'introspect':42 'javascript':87 'js':74 'json':6,23 'json-bas':5 'key':45 'languag':11 'like':36 'mix':50 'multi':39 'multi-ten':38 'mutat':49 'mysql':30,90 'nest':46 'offer':34 'oper':51 'orm':70,88 'orma':1,2,71 'parsabl':17 'plan':57 'postgresql':31,91 'pure':73 'queri':10,47,56 'releas':67 'safe':22 'serializ':18 'sql':13,26 'sqlite':33 'stabl':63 'static':8 'string':27 'support':29 'syntax':24 'tenanc':40 'type':9,21,53 'type-saf':20 'typescript':93 'unlik':68 'use':81 'valid':37 'version':58,64","created_at":"2026-06-04T18:53:37.620162+00:00","updated_at":"2026-06-04T18:53:37.620162+00:00","problems":[{"fix":"Replace `import orma from 'orma'` with `import { orma_query } from 'orma'`.","cause":"Default import used instead of named import.","error":"TypeError: orma_query is not a function"},{"fix":"Add `multipleStatements: true` to the pool configuration.","cause":"Database pool not configured with `multipleStatements: true`.","error":"Error: ER_MULTIPLE_STATEMENTS_DISABLED: Multiple statements are not allowed"},{"fix":"Call `pool.promise()` and pass the result to mysql2_adapter.","cause":"mysql2_adapter received a callback-based pool instead of promise-based.","error":"TypeError: pool.query is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mendeljacks/orma#readme","github":"https://github.com/mendeljacks/orma","docs":null,"changelog":null,"pypi":null,"npm":"orma","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}