-
Notifications
You must be signed in to change notification settings - Fork 171
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
SQL Server Connector Generates Duplicate Refs and Enums #669
Comments
Hi there, thank you for contacting us. We are currently looking into the issue and will get back to you later. |
Hi @asadcr ,
This solution is possible, but we have to detect the root cause of the issue. To do that, can you help provide us with your table structure (if possible)? You can send it via david.bui@holistics.io, and we ensure that your information is protected and used for the debugging purpose only. Thanks. |
@huyleminh01 i think the above data gives a lot of information. if you need any more info i will be happy to provide that. I have debugged already FYI so if u want some intermediate results in code, i can also provide |
Hi @asadcr , Thank you for replying. Also, it seems I reproduce your case. Here is my sql: CREATE TABLE AddressInfo (
AddressID UNIQUEIDENTIFIER NOT NULL,
AddressFormatID UNIQUEIDENTIFIER NOT NULL,
CONSTRAINT CK_Address_Valid CHECK (
AddressID IN ('176029FA-D6D3-49E1-A48C-000000000001', '176029FA-D6D3-49E1-A48C-000000000002') AND
AddressFormatID IN ('176029FA-D6D3-49E1-A48C-000000000001', '176029FA-D6D3-49E1-A48C-000000000002')
)
);
go So supprisingly, I got the duplicated enum: "enums": [
{
"name": "CK_Address_Valid",
"schemaName": "dbo",
"values": [
{
"name": "176029FA-D6D3-49E1-A48C-000000000002"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000001"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000002"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000001"
}
]
},
{
"name": "CK_Address_Valid",
"schemaName": "dbo",
"values": [
{
"name": "176029FA-D6D3-49E1-A48C-000000000002"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000001"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000002"
},
{
"name": "176029FA-D6D3-49E1-A48C-000000000001"
}
]
}
], |
so i ran
db2dbml mssql "Connection String"
andit has been failing with these errors
Here's the full stack trace
So i debugged the whole code and turns out fetchSchemaJson generates duplicate entries here
so in
enums
section it generated thisOne entry was duplicated so many times.
Next Error
Same Case
Had to remove the duplicate entries to fix the Data.
Next Error has the same case
This was due to fetchSchemaJson is generating duplicate Refs
Upon removing. it was able to generate the dbml successfully.
I am pretty sure a group-by command for uniqueness in enums and refs can fix this issue.
The text was updated successfully, but these errors were encountered: