All developer tools

Database

Format SQL, MongoDB, and GraphQL queries, or check GraphQL syntax.

Database and API query tools improve readability and validation, but they do not execute a query against your data. SQL Formatter and MongoDB Formatter arrange text for review; GraphQL Formatter makes an operation easier to inspect; GraphQL Validator can check syntax and, when you supply a schema, validate fields and arguments. A formatted query can still be slow or semantically wrong, so pair the visual result with your database’s own explain or validation tools.

Choose a formatter that matches the language. SQL dialects differ in keywords and quoting. MongoDB queries often include JavaScript-like objects or pipeline stages. GraphQL distinguishes its schema definition language from operations sent by clients. The validator’s optional schema editor matters: without a schema, a syntactically valid query may refer to a field that does not exist. Keep the target server version and schema nearby when reviewing the output.

Choose the right tool

  • SQL Formatter: Make joins, filters, and selected columns readable before reviewing a query plan.
  • MongoDB Formatter: Inspect a document query or aggregation pipeline stage by stage.
  • GraphQL Validator: Check an operation against a supplied schema for unknown fields, arguments, and fragment errors.

A practical workflow

For a new GraphQL endpoint, first format the schema so type definitions are easy to inspect. Paste that schema into GraphQL Validator’s Schema editor and paste a client operation into its Input editor. Correct any reported field or required-argument errors before sending the operation to a server. If the resolver then calls a SQL or MongoDB backend, use the relevant formatter to make the generated query legible, and use the backend’s own explain facility to investigate performance.

Things to check

  • Parsing a query without a schema checks grammar only. It cannot know whether a requested field exists on a type. See GraphQL Validator.
  • A formatter changes layout, not query semantics or indexes. A readable statement can still scan an entire table. See SQL Formatter.
  • Pipeline stage order affects results. Check the structure after formatting rather than assuming the tool optimized it. See MongoDB Formatter.

Related guides