datajoint-python icon indicating copy to clipboard operation
datajoint-python copied to clipboard

Underscores allowed in class names

Open rly opened this issue 2 years ago • 1 comments
trafficstars

Bug Report

Description

https://docs.datajoint.org/python/definition/02-Creating-Tables.html#valid-class-names says that class names must:

contain only alphanumerical characters (no underscores).

However, I can create a DataJoint class with underscores without error.

@schema
class This_is_a_Test(dj.Manual):
    definition = """
    id: int
    ---
    """

Interestingly, this creates a MySQL table named "this_is_a__test_test".

Is this a bug? If so, then I think in https://github.com/datajoint/datajoint-python/blob/master/datajoint/utils.py#L85 the re.match should be changed to re.fullmatch.

Reproducibility

MacOS, Python, DataJoint 0.13.8

rly avatar Dec 09 '22 00:12 rly

Good catch. You are right. Let's fix.

dimitri-yatsenko avatar Feb 07 '23 21:02 dimitri-yatsenko