db
upper/db is a Go data access layer that abstracts across multiple databases—PostgreSQL, MySQL, CockroachDB, MongoDB, SQLite, and others—with ORM-like query building. It has been actively maintained since 2013 and provides a single interface to work with both SQL and NoSQL data sources.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | upper/db |
| Owner | upper |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 3.7k |
| Forks | 238 |
| Open issues | 165 |
| Latest release | v4.10.0 (2025-03-09) |
| Last updated | 2025-12-06 |
| Source | https://github.com/upper/db |
What db is
upper/db is a database-agnostic DAL written in Go that provides query builders, model mapping, and transaction support for heterogeneous data sources including relational (PostgreSQL, MySQL, MSSQL, CockroachDB, SQLite) and document (MongoDB) stores. It abstracts database-specific dialects behind a unified interface, reducing boilerplate and vendor lock-in for polyglot persistence patterns.
Get the db source
Clone the repository and explore it locally.
git clone https://github.com/upper/db.gitcd db# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Verify adapter support for your target databases (PostgreSQL, MySQL, MSSQL, CockroachDB, MongoDB, SQLite); not all features are equally mature across backends.
- Plan for connection pooling configuration per database—upper/db delegates to underlying drivers, so tune driver settings appropriately.
- Test transactions and error handling across supported databases; behavior may vary (e.g., MongoDB's transaction support is more limited).
- Evaluate the ORM-like syntax against your query complexity; fallback to raw SQL may be needed for performance-critical paths.
- Review the 165 open issues to assess pain points relevant to your use case.
When to avoid it — and what to weigh
- Complex analytical queries — Data warehouse workloads requiring window functions, CTEs, and query optimization typically need lower-level control or dedicated SQL—upper/db's abstraction may obscure performance tuning.
- Strongly-typed compiled databases — If your schema is highly normalized and requires compile-time type safety guarantees, alternatives like sqlc or ent may be more appropriate.
- Established non-Go codebases — upper/db is Go-specific; migration from Java, Python, or Node.js stacks adds operational complexity if not part of a larger Go adoption plan.
- Expert-level database tuning — Projects where DBA-level control over execution plans, indexes, and query hints is critical may find the abstraction limiting.
License & commercial use
Licensed under the MIT License, which is a permissive OSI-approved license permitting commercial use, modification, and distribution with minimal restrictions. Attribution appreciated but not required.
MIT License explicitly permits commercial use. However, as with any open-source dependency, review the full LICENSE file and evaluate any third-party database drivers bundled with upper/db for their own license terms. No warranty is provided.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
upper/db relies on underlying database drivers for connection security (TLS, authentication). Parameterized queries reduce SQL injection risk. Ensure environment-based credential management (e.g., no hardcoded passwords in code). Database connection strings and secrets should be treated as sensitive. No security audits or vulnerability disclosures are mentioned in the provided data; assess via GitHub issues and external security tracking.
Alternatives to consider
sqlc
Type-safe SQL query generation with compile-time verification; stronger for complex queries and schema enforcement but less abstraction across database types.
ent
Go-native graph-based ORM with schema-as-code; better for strongly-typed models and deeper feature completeness, but opinionated and less database-agnostic.
GORM
More widely adopted Go ORM with richer ecosystem; supports multiple databases and complex features, but heavier footprint and steeper learning curve.
Build on db with DEV.co software developers
upper/db abstracts multiple databases behind a single interface. Our engineers can help you evaluate whether it fits your architecture, design a clean DAL integration, and optimize database performance.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
db FAQ
Does upper/db support transactions across multiple databases?
What is the performance overhead compared to raw driver usage?
Is upper/db suitable for microservices?
Can I migrate an application from upper/db if needed?
Work with a software development agency
Need help beyond evaluating db? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.
Need a flexible data layer for your Go application?
upper/db abstracts multiple databases behind a single interface. Our engineers can help you evaluate whether it fits your architecture, design a clean DAL integration, and optimize database performance.