Skip to content

Parser accepts table notes as last property only #49

Description

@aardjon

Hi,

the table notes example from the DBML docs can be parsed as-is by PyDBML. However, when the Note property is moved to any other position than the very last one (e.g. to the top):

Table users {
  Note: 'Stores user data'
  id integer
  status varchar [note: 'status']
}

PyDBML raises an error:

>>> parsed = PyDBML(Path('test.dbml'), allow_properties=True)
pyparsing.exceptions.ParseException: Expected {{{W:(0-9A-Z_a-zª²³...) | string enclosed in '"'} '[]'} | {W:(0-9A-Z_a-zª²³...) | string enclosed in '"'} '.' {W:(0-9A-Z_a-zª²³...) | string enclosed in '"'} | {{W:(0-9A-Z_a-zª²³...) | string enclosed in '"'} ['(' {Empty Forward: [{{{{[W:(0-9A-Z_a-z)] '(' : ...} ')'} | {W:("'+-.0-9A-Z_-z) {{',' | ');'} | {end of line ');'}}}} | W:(
 "'+-.0-9A-...)}]... Empty} ')']}}, found ':'  (at char 20), (line:2, col:7)

The modified table definition can be rendered just fine with https://dbdiagram.io, though. Personally, I'd love to see the same behavior with both parsers. What do you think - should these restrictions be loosened in the parser, or is there a certain reason for them?

Best regards,
Aardjon

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions