# SQLTy vs bob

[bob](<https://github.com/stephenafamo/bob>) is a Go ORM, query builder and code generator, and also types the queries in your `.sql` files (`queries.GetUser(email).One(ctx, db)`). To read the schema it runs your migrations in a container. SQLTy checks raw SQL constants and your own structs in `go vet`, from the schema files, with no generated code.

## Quick comparison

|  | bob 0.51 | [SQLTy for Go](<https://sqlty.kuncar.dev/recipes/go/index.md>) (preview) |
| --- | --- | --- |
| Approach | Generated ORM, query builder and query functions | Your structs and SQL constants, checked |
| Needs a database | Yes for PostgreSQL and MySQL: testcontainers | No |
| Drivers | `database/sql`, pgx | pgx v5 |
| Databases | PostgreSQL, MySQL, SQLite | PostgreSQL |
| Dynamic queries | Builder, and mods on generated queries | Not checked |
| Nullability overrides | `name:type:nullable` annotations | Inferred, no overrides |
| Cursor, nested rows | `Cursor`, nested to-one/to-many by column prefix | `Each`; embedded structs only |
| Lint rules | None | Over 70 |

## Where SQLTy is stronger

- No container at generate time, and no generated layer to review.
- Lint rules, including migration safety on the same schema.

## Where bob is stronger

- A full ORM and builder for dynamic queries.
- Three databases and `database/sql`.
- Nested result mapping and annotations for nullability and types.

## Which should you choose?

Choose bob if you want an ORM with generated models. Choose SQLTy if your queries are raw SQL and you want them checked without generated code or containers.

## What SQLTy is missing

- `database/sql`, MySQL, SQLite, type overrides and nested result structs.

## Common questions

### Can bob and SQLTy share a schema?

Yes. SQLTy reads `CREATE TABLE` files and migration directories, so it can read the migrations bob runs.

## Sources

- [bob](<https://github.com/stephenafamo/bob>) 0.51.0 docs: code generation from SQL, query annotations, configuration; still the latest release (2026-12-01); run on PostgreSQL 16 (2026-11-27)
