Skip to main content

Here’s a question!

Microsoft Dataverse currently hosts our Dynamics 365.  We are trying to create an ERD of the relevant parts of D365 and present it LucidChart (we don’t use all the functions of Dynamics).  There isn’t a standard database connector for Microsoft Dataverse, so the only way we can currently see of building our ERD and keeping it updated is manually.  Does anyone know of an alternative way of doing this? 

Someone has suggested we can get the entities into Excel and then into Lucid, but this seems a rather long-winded & manual approach.

Guidance gratefully accepted.

 

@Kevin Plunkett I believe this thread will give you the answers you are seeking: 

It does seem that the solutions are manually-oriented but that there is more than one option.


Thank you but this goes nowhere near to answer the question I’ve asked.  Dynamics if the Microsoft CRM, Financial & ERP platform and having the ability to be able to understand the ERD that supports this would be massively useful.  


Hi @Kevin Plunkett

Thanks for following up! A workaround alternative to manually building your ERD is to format your data as a PostgreSQL, using the attached document for reference. If you can export your data from Microsoft Dataverse in the attached format, you can then upload your data as shown below.

  1. From a Lucidchart board, select File > Import > Data > Entity relationship (ERD) > Import from SQL Database
  1. Select PostgreSQL > Next > and follow the prompts to upload your files

 

I hope that is helpful! Please let me know if you have any further questions! I would be happy to help find another solution for you.


I created a custom script for dataverse.
I cheated a bit with constraints and the ordinal position of columns, but it does the trick.

The result of the script can be used the same as a normal MSSQL database
 

SELECT			'sqlserver' dbms,
d.name AS TABLE_CATALOG,
s.name AS TABLE_SCHEMA,
t.name AS TABLE_NAME,
c.name AS COLUMN_NAME,
c.column_id AS ORDINAL_POSITION,
dt.name AS DATA_TYPE,
CASE
WHEN dt.name = 'nvarchar' THEN c.max_length
ELSE NULL
END AS CHARACTER_MAXIMUM_LENGTH,
CASE
WHEN pk.CONSTRAINT_TYPE = 'PRIMARY KEY' THEN pk.CONSTRAINT_TYPE
ELSE
CASE
WHEN fk.CONSTRAINT_TYPE = 'FOREIGN KEY' THEN fk.CONSTRAINT_TYPE
ELSE NULL
END

END AS CONSTRAINT_TYPE,
fk.TABLE_SCHEMA,
fk.TABLE_NAME,
fk.COLUMN_NAME
FROM sys.tables t
INNER JOIN sys.databases d ON d.database_id = t.DatabaseId
INNER JOIN sys.schemas s ON s.schema_id = t.schema_id
INNER JOIN sys.columns c ON c.object_id = t.object_id
INNER JOIN sys.types dt ON dt.system_type_id = c.system_type_id
LEFT JOIN (
select
tc.column_id,
t.object_id,
'PRIMARY KEY' AS CONSTRAINT_TYPE
from
sys.schemas s
inner join sys.tables t on s.schema_id=t.schema_id
inner join sys.indexes i on t.object_id=i.object_id
inner join sys.index_columns ic on i.object_id=ic.object_id
and i.index_id=ic.index_id
inner join sys.columns tc on ic.object_id=tc.object_id
and ic.column_id=tc.column_id
where i.is_primary_key=1

) AS pk ON pk.column_id = c.column_id AND pk.object_id = t.object_id
LEFT JOIN (
SELECT fk_tmp.parent_column_id,
fk_tmp.parent_object_id,
'FOREIGN KEY' AS CONSTRAINT_TYPE,
fk_s.name AS TABLE_SCHEMA,
fk_t.name AS TABLE_NAME,
fk_c.name AS COLUMN_NAME
FROM sys.foreign_key_columns fk_tmp
INNER JOIN sys.tables fk_t ON fk_t.object_id = fk_tmp.referenced_object_id
INNER JOIN sys.schemas fk_s ON fk_s.schema_id = fk_t.schema_id
INNER JOIN sys.columns fk_c ON fk_c.object_id = fk_t.object_id AND fk_c.column_id = fk_tmp.referenced_column_id
) AS fk ON fk.parent_column_id = c.column_id AND fk.parent_object_id = t.object_id

 


Hi ​@Rolf Schouteten, thank you for sharing this!