The Zuri Standard Library Zuri

Databases

sql.model.naming

import sql.model.naming
Zuri

sql lifts part of this module out to its own top level; each name below is shown with the path that reaches it. Anything still spelled sql.model.naming.* needs import sql.model.naming.

The names that a model uses when it doesn't specify its own.

A model's table name is its class name in snake case, made plural with the regular rules of English: Post becomes posts, BlogPost becomes blog_posts, Category becomes categories and Address becomes addresses. For a word with an irregular plural, such as Person and people, give the table name with model.table().

Functions

snake()

sql.model.naming.snake(name: string) -> string
Zuri

A class name in snake case: BlogPost is blog_post, HTTPRequest is http_request, and a name in snake case already stays as it is.

Parameters

  • name (string)

Returns string

plural()

sql.model.naming.plural(word: string) -> string
Zuri

A word made plural by the regular rules. Words ending in s, x, z, ch and sh add es, a y after a consonant becomes ies, and everything else adds s. Only the last word of a snake case name changes.

Parameters

  • word (string)

Returns string

table_for()

sql.model.table_for(name: string) -> string
Zuri

The table a class of this name maps to: plural(snake(name)).

Parameters

  • name (string)

Returns string

key_for()

sql.model.naming.key_for(name: string) -> string
Zuri

The column another table refers to this class's rows by: its snake case name and _id, as author_id refers to an Author.

Parameters

  • name (string)

Returns string

join_table_for()

sql.model.naming.join_table_for(first: string, second: string) -> string
Zuri

The table joining two classes in a many-to-many association: their snake case names in alphabetical order, joined by an underscore, as post_tag joins Post and Tag.

Parameters

  • first (string)
  • second (string)

Returns string


2026, Richard Ore and Zuri contributors