sql2dbml fail to generate note if dbo specified

Aperta
#489 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@huydo862003 ci sta già lavorando.

Dal 6/11/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

Hi,

When you explicitly specify the dbo schema in front of the table, if comments are added to a column with EXEC sp_addextendedproperty (by specifying the dbo schema), these will not appear in the "note" of the columns concerned in the generated dbml via sql2dbml

Let's take the DDL noschema_specified_is_OK.sql

>>> cat ok.sql
CREATE TABLE mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'dbo',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql noschema_specified_is_OK.sql
Table "mytable" {
  "a" int [note: 'This is the description of my column']
}

All is fine here.

Now try with specified_schema_is_OK.sql

>>> cat specified_schema_is_OK.sql
CREATE TABLE myschema.mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'myschema',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql specified_schema_is_OK.sql
Table "myschema"."mytable" {
  "a" int [note: 'This is the description of my column']
}

All is fine here.

Now try with replacing myschema by dbo in file specified_dbo_is_NOK.sql

>>> cat specified_dbo_is_NOK.sql
CREATE TABLE dbo.mytable(
 a int
)
GO

EXEC sp_addextendedproperty
@name = N'Column_Description',
@value = 'This is the description of my column',
@level0type = N'Schema', @level0name = 'dbo',
@level1type = N'Table', @level1name = 'mytable',
@level2type = N'Column', @level2name = 'a'
GO

>>> sql2dbml --mssql specified_dbo_is_NOK.sql
Table "dbo"."mytable" {
  "a" int
}

In this case, there is a problem, the note corresponding to column's a comment doesn't appears

>>>sql2dbml --version
3.0.0
Lingua principale
JavaScript
Stelle
3.7k
Fork
233
Merge medio
2g 4h
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di holistics/dbml

Tutte le issue di holistics/dbml

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.