使用SQL檔案自動生成資料庫文件

2021-09-19 10:23:12 字數 826 閱讀 7008

來新公司實習剛過一周時間,一開始都在嘗試看專案**,資料庫表結構等,因為沒有完備的文件,所以看起來還是相當困難的,也是因為看資料庫時,每次需要一張表一張表的翻,非常麻煩,就想著寫個指令碼通過sql檔案生成資料庫文件,而且當前比較流行markdown,所以就為sql檔案生成了md格式的資料庫文件,於是就有了該指令碼。

目錄結構:

md/

fileparserclass.py

markdownbuildclass.py

build.py

readme.md

其中生成的md文件將儲存到md目錄下.

fileparserclass.py檔案實現從sql檔案中獲取資料庫表結構

markdownbuildclass.py檔案為上面檔案中獲取到的資料庫表結構加入md語法

build.py檔案為執行檔案,執行該檔案,即可實現文件生成。

readme.md為指令碼使用說明。

sql檔案圖:

生成的md檔案圖:

解析後的檔案圖:

傳送門:

[4]:

自動生成資料庫字典

1.首先需要填寫表的每一列的說明 2.建立試圖 go object view dbo sura view dbdictionary script date 05 31 2013 17 19 19 set ansi nulls on goset quoted identifier on gocreat...

生成資料庫字典SQL

select 表名 case when a.colorder 1 then d.name else end,表說明 case when a.colorder 1 then isnull f.value,else end,字段序號 a.colorder,欄位名 a.name,標識 case when ...

使用PowerDesigner生成資料庫測試資料

方法如下 a 在powerdesigner 建表 b 然後給每乙個表的字段建立相應的摘要檔案 步驟如下 model test data profiles配置每乙個字段摘要檔案general 輸入name code 選擇class 數字 字元 時間 型別 選擇generation source aut...