如何/什么导入到 dbdiagram.io?
嘿,我对数据库很陌生,我想创建一个我正在使用 dbdiagram.io 的数据库图表,这样我就无法更好地理解这些关系。我应该使用哪种脚本/文件从 sql server 导入架构?我目前正在使用 azure data studio 来查询数据库。我不想用手写出所有的表格。
Hey I'm pretty new to databases and I want to create a diagram of the db I'm using with dbdiagram.io so that I can't understand the relationships better. What sort of script/file am I supposed to use to import the schema from sql server? I'm currently using azure data studio to query the database. I would prefer not to have to write out all the tables by hand.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于docs 和 dbml语言,您需要从选择的RDBMS以以下格式生成DBML脚本 - 在这种情况下,SQL Server:
请注意,此DBML输出是不打算在RDBMS,SQL Server或其他情况下运行 - 这些平台不了解DBML。这是您需要从生成的rdbms的一个示例6332392F7B3D2034FFC0571D“ rel =“ nofollow noreferrer”>如下所示。
这个更复杂的示例在Stack Exchange Data Explorer中(和哪个我在这里描述了) - 花了大约40秒的时间来创建。
您可以从一组表中构建此语法,而无需使用目录视图进行精心编码,例如
sys.tables
和sys.columns
,但是有很多您需要做的小事情才能使其与此网站兼容,这将是一个自己的项目。基本上,SQL Server中没有任何东西可以为您生成漂亮的,整洁的DBML。如果您不想使用dbml,而宁愿在网站上使用
import
功能,那么您可以生成传统的DDL脚本 - 从SQL Server,您可以通过右键单击该脚本来执行此操作。 SSMS / Object Explorer中的数据库,并使用脚本数据库为< / code>&gt; <代码>创建到
。 Azure Data Studio还没有此功能,但是您可以使用扩展名。Based on the docs and the DBML language, you need to generate a DBML script in the following format from your RDBMS of choice - in this case, SQL Server:
Note that this DBML output is not intended to run on your RDBMS, SQL Server or otherwise - those platforms don't understand DBML. It is an example of output you need to generate from your RDBMS that you can paste directly into the left editor pane on dbdiagram.io, as demonstrated here.
This more complicated example - which uses DBML to build a diagram from SQL Server based on a subset of the tables in Stack Exchange Data Explorer (and which I described here) - took about 40 seconds to create.
You can build this syntax from a set of tables without having to hard-code each one using catalog views like
sys.tables
andsys.columns
, but there are a lot of little things that you'll have to do to make it compatible with this web site, and that will be a project all its own. Basically, nothing in SQL Server exists to generate nice, tidy DBML for you.If you don't want to use DBML but would rather use the
Import
feature on the web site, then you can generate traditional DDL scripts instead - from SQL Server, you can do this by right-clicking the database in SSMS / Object Explorer and usingScript Database as
>CREATE To
. Azure Data Studio doesn't yet have this functionality, but you can use an extension.