Skip to content

Commit edc495d

Browse files
committed
fix: accept table names starting with _
1 parent 418b371 commit edc495d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/server/templates/python.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,19 @@ const PY_TYPE_MAP: Record<string, string> = {
384384
* formatForPyTypeName('pokemon league') // PokemonLeague
385385
* ```
386386
*/
387+
387388
function formatForPyClassName(name: string): string {
388389
return name
389390
.split(/[^a-zA-Z0-9]/)
390-
.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`)
391+
.map((word) => {
392+
if (word) {
393+
return `${word[0].toUpperCase()}${word.slice(1)}`
394+
} else {
395+
return ''
396+
}
397+
})
391398
.join('')
392399
}
393-
394400
/**
395401
* Converts a Postgres name to snake_case.
396402
*

0 commit comments

Comments
 (0)