-
Notifications
You must be signed in to change notification settings - Fork 30
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
The Schema Visualization is stuck at "Getting structure from database..." #29
Comments
Hello, thank you for reporting the issue! SELECT
T.TABLE_NAME,
Columns.COLUMN_NAME,
(SELECT TOP 1
KCU2.TABLE_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON
KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND
KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND
KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON
KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND
KCU2.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND
KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME
WHERE KCU1.ORDINAL_POSITION = KCU2.ORDINAL_POSITION AND
KCU1.TABLE_NAME = T.TABLE_NAME AND KCU1.COLUMN_NAME = Columns.COLUMN_NAME) as REFERENCE_TO_TABLE,
(SELECT TOP 1
KCU2.COLUMN_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON
KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND
KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND
KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON
KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND
KCU2.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND
KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME
WHERE KCU1.ORDINAL_POSITION = KCU2.ORDINAL_POSITION AND
KCU1.TABLE_NAME = T.TABLE_NAME AND KCU1.COLUMN_NAME = Columns.COLUMN_NAME) as REFERENCE_COLUMN,
(SELECT TOP 1 KCU1.CONSTRAINT_NAME AS 'FOREIGN_KEY'
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU1 ON
KCU1.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND
KCU1.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND
KCU1.CONSTRAINT_NAME = RC.CONSTRAINT_NAME
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU2 ON
KCU2.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND
KCU2.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND
KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME
WHERE KCU1.ORDINAL_POSITION = KCU2.ORDINAL_POSITION AND
KCU1.TABLE_NAME = T.TABLE_NAME AND KCU1.COLUMN_NAME = Columns.COLUMN_NAME
) as FOREIGN_KEY
FROM INFORMATION_SCHEMA.TABLES T
INNER JOIN INFORMATION_SCHEMA.COLUMNS Columns ON Columns.TABLE_NAME = T.TABLE_NAME
WHERE T.TABLE_TYPE='BASE TABLE' |
Pretty sure I also have this issue, tried to modify source but not sure how to re-build to vsix file (I tried a few things and none worked) so looking forward to a release with this change for me! :) |
I published a patch version you could try: https://github.com/R0tenur/visualization/releases/tag/v0.7.1 |
Thanks! unfortunately, it's still throwing an error and hanging: The query runs okay, returns 152 lines when I run it as a standalone query in data studio. Happy to send whatever debug info might help.. |
Stuck with the same issue - any help would be appreciated! Installed 0.7.1, attempting to visualize an azure sql db, ran the query above without issues returning 755 rows |
Hello ! It seems I have the same issue : I have 0.7.1 installed, and query you posted 9 Apr ran without issues. I caught these errors in Developer Tools Console :
|
Hello, sorry for slow reply, I am currently on parental leave and have limited time to work on any projects. I am not able to reproduce this myself but if there is any interest to help fixing this bug I am happy to support you running the project locally. |
Got same results with this query as original against AdventureWorks, and this removes correlated subqueries. Speed massively increased. I/O dropped significantly. Working on PR for R0tenur#29 .
Removed correlated subqueries from sys DMV query. R0tenur#29
Got same results with this query as original against AdventureWorks, and this removes correlated subqueries. Speed massively increased. I/O dropped significantly. Working on PR for R0tenur#29 .
Thanks to @bruce-dunwiddie there should be a fix for this in release v0.8.0 If the error still occurs, please comment here and I will reopen the issue. |
Hello, I installed new release v0.8.0, but the error still occurs with same log in developer tools console : The schema visualization is still stuck at "Getting the database structure..." My database is on a remote local server which I login with SQL authentication. If I can help by sending any more debug info, just let me know :) |
@Zangdorf , how long did the query from Apr 9 take to run on your remote connection to the database? How many rows were returned? How long does it take to run the new query?
|
Hi, I tried to run both queries on 2 different databases (one which is huge, and a tiny one). Here is the result : huge DB :
tiny DB :
Both DB are located on the same remote local server, and both cannot display Schema Visualization. |
@Zangdorf , thank you for your replies and helping us to troubleshoot this issue. We've at least eliminated speed issues. Can you please run this query and send back the result so we can know what version of SQL you're using?
|
Sure, Microsoft SQL Server 2017 (RTM-CU26) (KB5005226) - 14.0.3411.3 (X64) Aug 24 2021 09:59:15 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor) |
@Zangdorf , thank you. That looks to be a fairly standard version. @R0tenur , my best suggestion for simulating this issue is to edit the schema query to make it invalid and throw an error, and then see how the error bubbles up, even though it would appear that the queries are working when run directly.
database.errors is not getting set in getMssqlDbSchema, and there is no error trap to catch an exception bubbling up. My javascript is rusty so I'm not currently able to suggest the best line of code for catching errors from your Promises. It may be an error within the toTables function when mapping the query results back to the collections. When I alter the schema query to be invalid, I similarly stall at this step and get no error message, other than a similar error message in the Debug Console as posted above. |
I will a look during the weekend |
I have created an release that propagates the errors to the UI. @Zangdorf It would be helpful if you could try Release v0.8.1 and post the real error in here. |
@R0tenur , brainstorming here. It's definitely just like the error message says, no results returned. Only one odd thing comes to mind that might cause that, but it seems very odd for a SELECT. You could possibly get this same error if the resultset that we're looking for is not the first resultset. In MSSQL, it's common on UPDATE/DELETE to SET NOCOUNT ON to prevent "rows affected" messages from throwing off the resultset index. @Zangdorf , is it possible that there's an audit system in place that is logging rows returned by queries into another table? When you run the query in Management Studio, are there multiple "rows affected" messages logged in the "Messages" tab? @R0tenur , if not something odd like the situation above, then it almost has to be something around pulling the security context and credentials over from the hosting application. Are you able to propagate a SQL exception up from the SQL library? Is it possible that it's reporting something like "can't connect" or "user does not have access"? |
Fyi: on one db i get a result, on another (the bigger one of the 2) i get the same error as @Zangdorf . |
No, I don't have this kind of feed redirection embedded in my database, and I have a unique line "rows affected" when I run the query: One thing that comes to my mind, I have a firewall that prevents some resources being loaded from the external network. Do you know if your extension module requires external resources to run the query properly ? I will try to run the project from source (using your installation and building doc). If I manage to, maybe I will find more error details and I will come back to you. |
Hello, I managed to make it work ! I saw that in the code the query was made up of two statements :
By deleting the first statement :
the following promise
is not throwing an error anymore and schema visualization is displayed correctly. Thanks to @R0tenur and @bruce-dunwiddie for your help and your investment on the issue :) |
Any chance someone can put this into a VSIX so i can try it on mine? Doing way tooo many things lately, sorry! |
Hopefully I will have the time to look into this tonight. If you want to build it your self ther is a guide Here |
Hi, here is the vsix file compiled with yarn and including my fix. I hope it will work for you aswell :) |
Thank you. On the 2 db's i've tried out this add-on, one works (except for the zoom, but have filed a seperate issue for that), and the bigger one now throws a 'Maximum text size in diagram exceeded' (and very fast after starting the visualisation). |
I have tried to add a fix for this by using the native azdata way of selecting the db. If someone with the issue could test the Release v0.8.2 |
Yeah ! Release v0.8.2 works fine in my case 👌 |
This is an limitation in mermaid to prevent blocking the UI. I have already increased the limitation in #49 but have added another issue #68 to put the workload in a web worker. I need to setup som crazy test data to fix this and the zoom thingy #62 :) |
I will again close this and reopen if the error will happen again |
Initial screen:
After switching to other tab the message and the loader are gone:
The fixed informationsSchemaQuery query mentioned in issue #7:
visualization/src/repositories/mssql.repository.ts
Line 165 in a4421ea
returns the following error:
Meanwhile, the original query using sys tables returns the actual tables.
visualization/src/repositories/mssql.repository.ts
Line 43 in 4be706d
The text was updated successfully, but these errors were encountered: