xo/dbtpl

Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 1 hour ago
Added to GitGenius on September 17th, 2026
Created on February 5th, 2016
Open Issues & Pull Requests: 70 (+0)
GitHub issues: Enabled
Number of forks: 337
Total Stargazers: 3,898 (+0)
Total Subscribers: 63 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 14.0 hours
Mean response time: 191.8 days
90th percentile: 472.3 days
Tracked items: 13

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 16
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 517 days
Stale 30+ days: 14
Stale 90+ days: 14

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

dbtpl is a command-line code generator that produces idiomatic Go code from database schemas and SQL queries.

The tool solves the problem of manually writing boilerplate Go types and database access code by inspecting database metadata and applying customizable Go templates to discovered schema elements. It connects directly to your database, introspects tables, enums, stored procedures, and custom queries, then generates type definitions and related code. Beyond model generation, it can produce schema creation scripts, JSON and YAML schema definitions, and Graphviz diagrams. The tool operates in two modes: schema mode inspects your entire database structure, while query mode parses individual SQL queries to generate type-safe code for those specific operations.

The tool supports PostgreSQL, MySQL, Oracle, Microsoft SQL Server, and SQLite, with feature coverage varying by database. PostgreSQL and MySQL have the broadest support including enums and custom types, while all five databases support models, keys, indexes, stored procedures, and functions. Adoption suits teams working with Go who want to reduce manual schema-to-code translation and maintain consistency across database access layers. The generated code is production-quality but the tool is not positioned as a complete replacement for hand-authored SQL and Go code; it handles the repetitive structural parts while leaving room for custom logic and optimization.

The project maintains a focused scope on Go code generation with no current plans to support other languages. Development activity shows deliberate prioritization of database compatibility across major platforms rather than language expansion, suggesting the maintainers are committed to deepening support for existing databases rather than broadening the tool's scope.