Skip to content

Bug: [default: now()] fails, while [default: 'now()'] works fine #71

Description

@DimitrijeGlibic

Hi, I have this dbml code that I am trying to parse but it fails:

Table users {
  id integer [primary key]
  username varchar [not null]
  email varchar [unique, not null]
  created_at timestamp [default: `now()`]
}

It seems that the problem is in [default: now()] or to be more precise in backtick character ` so when I switch to single quote character instead of backtick it works fine. So this actually works:

Table users {
  id integer [primary key]
  username varchar [not null]
  email varchar [unique, not null]
  created_at timestamp [default: 'now()']
}

The only difference is that I have replaced backticks (`) with single quotes (').

I am using pydbml~=1.2.1, and this is example of implementation: https://github.com/scafoldr/scafoldr/blob/add-code-generator-page/core/src/core/scafoldr_schema/dbml_scafoldr_schema_maker.py , also I am using it here to validate DBML code generated from the ai agent: https://github.com/scafoldr/scafoldr/blob/3a0ce328c66fd9f22c15eea93a45db539fe7291e/core/src/core/dbml_ai_assistant/dbml_ai_agent.py#L97

Also I have checked in DBML docs and using backticks (`) seems to be valid syntax.

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