grist-core
grist-core copied to clipboard
Table name automatically capitalizes internal table name first letter
Not a bug per-se, but surprising behaviour.
Upon renaming a table:
The internal table name automatically capitalizes the first letter:
Yes, that's a little awkward. There are a few other changes that can happen also to the name you set, such as spaces becoming underscores. For columns, the distinction between a "column label" (which can be anything) and a "column id" (which we try to make as similar as possible subject to some constraints) is made fairly clear in the UI, and can be explicitly controlled by the user. The raw data view makes a distinction between "table name" and "table id", but does not offer a way to control the id. I wonder if it would be practical to allow that - do you know @dsagal ?
We could allow controlling the tableId, yes. The reasons for the capitalization are:
- consistency -- having all tables capitalized makes it easier to tell that a particular identifier probably refers to a table
- since table IDs are available as global variables in Python (for formulas like
People.lookupOne(...)
orDepartments.all.Name
), a lowercase name would open up conflicts with other Python global identifiers, likeproperty
ordir
, and some names would not be allowed at all (likeclass
).
So I think capitalizing the table ID is still a good default, but allowing to manually override it (taking care to avoid Python keywords) seems OK to me.