Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments / references #282

Open
erwin-frohsinn opened this issue Aug 17, 2024 · 0 comments
Open

Comments / references #282

erwin-frohsinn opened this issue Aug 17, 2024 · 0 comments

Comments

@erwin-frohsinn
Copy link

Describe the bug
Actually, more of an annoyance instead of a bug.

CREATE TABLE pole.t_spiel (
	id varchar(10) NOT NULL, -- Comment 0 
	refprodid varchar(10) NOT NULL, -- Comment 1 // references is empty
	titel varchar(100) NOT NULL, -- Comment 2
	datum date NOT NULL,
	uhrzeit time NOT NULL, 
	dauer int4 NOT NULL, -- Comment 3, should be 5
	CONSTRAINT t_spiel_pk PRIMARY KEY (id),
        CONSTRAINT foreign_key_t_produktion FOREIGN KEY (refprodid) REFERENCES pole.t_produktion (id)
);

The above ddl demonstrates two issues:

  1. I would expect that the field references in the column describing refprodid would contain pole.t_produktion (id), but it is empty.

  2. The comments are all parsed but such, that the connection to the corresponding field is lost, because fields without comments are left out. Several ways to solve:
    a) create entries with empty strings, where no comment exists
    b) create a dictionary of comments instead, where the key is the field name and the value is the comment
    c) create a new field "comment" as part of the column (preferable in my opinion).
    Why do I need this? I do a postprocessing of the parsed structure in which I take the comments as hints for the users and additionally to qualify the fields for their presentation. Currently, I've programmed a workaround, but of course, I'd prefer if simply-ddl-parser would support this in the first place.

To Reproduce
Parse with simple_ddl_parser

Desktop (please complete the following information):

OS: Kubuntu
Python 3.12
Postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant