Skip to content

Trailing comma in generated SQL for DBML enums #58

@ralfschulze

Description

@ralfschulze

When converting a DBML enum to sql, the last entry of the generated CREATE TYPE statement has a trailing comma, which must not be there for PostgreSQL (see https://www.postgresql.org/docs/current/sql-createtype.html). Executing this statements fails with an error.

Example:

enum test_enum {
  valA
  valB
}

to sql

>>> from pydbml import PyDBML
>>> from pathlib import Path
>>> parsed = PyDBML(Path('test.dbml'))
>>> print(parsed.sql)
CREATE TYPE "test_enum" AS ENUM (
  'valA',
  'valB',
);

It should be

CREATE TYPE "test_enum" AS ENUM (
  'valA',
  'valB'
);

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