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

schema name should not allow "upper-case"

Open ttngu207 opened this issue 6 years ago • 1 comments

A schema name with upper-case letter in it will result in incorrect behavior when referenced by another schema. Note: no error thrown

Quick example:

schema = dj.schema('Schema_A')
@schema
class Subject(dj.Manual)
    definition = """
    name: varchar(32)
    """

schema = dj.schema('schema_b')

@schema
class Recording(dj.Manual)
    definition = """
    -> Schema_A.Subject
    id: smallint
    """

Here, schema_b.Recording will not be able to reference Schema_A.Subject properly.

ttngu207 avatar Feb 20 '19 18:02 ttngu207

@ttngu207 Hmm, for this one I am a bit unclear what you mean by

schema_b.Recording will not be able to reference Schema_A.Subject properly

How about like this?

schema1 = dj.Schema('Schema_A')

@schema1
class Subject(dj.Manual):
    definition = """
    name: varchar(32)
    """

Schema_A = dj.VirtualModule('Schema_A', 'Schema_A')

schema2 = dj.Schema('schema_b')

@schema2
class Recording(dj.Manual):
    definition = """
    -> Schema_A.Subject
    id: smallint
    """

schema2.drop()
schema1.drop()

In PR #893, I've added a test for this specific example.

guzman-raphael avatar Mar 25 '21 23:03 guzman-raphael