You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python and Go generators ignore per-entity table override (parity with #98) #107
Follow-up to #98 (fixed for TypeScript in PR #106). The Python and Go generators derive the table name the same way the TS generator did — snakeCase(entity.name) — and never read the per-entity table override, so they have the same bug: an entity named Order with "table": "order_record" generates the reserved word order.
Evidence
src/lib/generators/python.ts sets snakeCasedName: snakeCase(name); templates/python/models/model.eta uses __tablename__ = "<%= it.snakeCasedName %>" (and the same value for FK/join-table/index names).
src/lib/generators/go.ts sets snakeCasedName: snakeCase(name); templates/go/models/model.eta returns "<%= it.snakeCasedName %>" as the table name.
Recommended fix
Mirror #106: add a tableName = entity.table || snakeCase(name) field and use it for the actual table name (__tablename__ / Go TableName()). Note both templates also interpolate snakeCasedName into FK references, join-table names, and index names — decide whether those should follow the overridden table name too (TypeORM sidesteps this because it derives FKs from entity classes, not string names). Add generator tests as in #106.
Auto-fix eligibility
Localized generator/template fix with tests; no publish/deploy side effect until merged (merge publishes @apso/cli). Same class as #98.
Fixed in PR #119 (base `main`). Ported the #106 pattern to both generators: they now surface `tableName = entity.table || snakeCase(name)`.
Go: `TableName()` returns the override.
Python: the override flows to `tablename` and the self-referencing ManyToMany `ForeignKey`, join-table name, join-column prefix, and index name — so every reference to this entity's own table stays consistent (needed in SQLAlchemy, where the join FK references the table by string name).
Byte-identical output without an override. Override + fallback tests added to both suites; full suite 318/0. Cross-entity FKs to other tables left out of scope, matching #106. Merge = npm publish, so left for Matt.
Activity
cultron commentedon Aug 1, 2026
Fixed in PR #119 (base `main`). Ported the #106 pattern to both generators: they now surface `tableName = entity.table || snakeCase(name)`.
Byte-identical output without an override. Override + fallback tests added to both suites; full suite 318/0. Cross-entity FKs to other tables left out of scope, matching #106. Merge = npm publish, so left for Matt.
— apso-build, 2026-08-01
fix(cli): honor per-entity table override in Python and Go generators (…