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

Multiple '---' in definition are allowed but can lead to confusion

Open guzman-raphael opened this issue 4 years ago • 0 comments
trafficstars

Bug Report

Description

A user decides to include multiple lines beginning with '---' and no error was thrown while parsing. This can lead to confusion as user believes that this has been accepted as correct definition format. Expectation would be to throw an error so that user can be explicit in defining which are primary key attributes and which are secondary attributes.

Reproducibility

Include:

  • OS: Linux
  • Python Version: 3.8.1
  • MySQL Version: 5.7
  • MySQL Deployment Strategy: local-docker
  • DataJoint Version: 0.12.7
  • Steps:
    import datajoint as dj
    schema = dj.Schema('test')
    
    @schema
    class Flight(dj.Manual):
      definition = """
      flight_no  : int
      ---
      economy_price : decimal(6,2)
      departure : datetime
      arrival : datetime 
      ---
      origin_code : int
      dest_code : int
      """
    
      print(Flight())
    

Expected Behavior

Expected to throw DataJointError error.

Additional Research and Context

  • StackOverflow user recently asked a question where his definition was stated in this way.
  • In terms of addressing, this is likely a good place to start.

guzman-raphael avatar Jan 06 '21 20:01 guzman-raphael