Creating a data dictionary

A data dictionary is a document that helps you understand what is in your database. It includes things such as the names of all the objects, tables, and column names, what the data type of each column is, and any constraints on table columns. The data dictionary can also include any notes about the tables you think would be necessary for people to know about the data.

To create a data dictionary in MySQL for free, you will need to install a Python plugin into your MySQL Workbench installation. The Python file you will need for this can be found in the code files you downloaded in the Technical requirements section of this chapter. Follow these steps to install the plugin: 

  1. In MySQL Workbench, click Scripting from the menu and click Install Plugin/Module...:

  1. Navigate to the location of the chapter-13 files, choose the mysql-workbench-plugin-doc-generating.py file, and click Open. For more information about this Python plugin, visit https://github.com/letrunghieu/mysql-workbench-plugin-doc-generating/blob/master/LICENSE:

  1. A popup will appear, letting you know that the plugin has been installed and that you need to restart MySQL Workbench to use it. Click OK on the popup and close and reopen MySQL Workbench:

 

  1. Once you have installed the plugin, you will need to create an Entity-Relationship Diagram (ERD). The steps to create this were covered in Chapter 7Querying Multiple Tables. To recap how to start the ERD process, you click on the Database menu item and click Reverse Engineer. Then, you follow the steps provided to get the objects you want into the ERD. We will start the data dictionary creation process after the ERD has been created.

Once you have generated your ERD, click Tools in the menu, then Utilities, and then Generate documentation (Markdown)

Once you've done that, you will have the documentation in the clipboard on your computer so that you can paste it into the file of your choosing.

You could just paste it into a text file, but it works best for readability purposes when it's in a Markdown editor. There are many free markdown editors. I use Typora, but you can install any one of your choosing.

You will need to open your markdown editor and make sure that you have a blank markdown file before pasting the markdown from MySQL Workbench into the file. Then, you will have something that looks similar to the following:

This markdown file will contain each table, along with its columns and their types, attributes, and constraints. You can also add a description for each table and a description for each column if needed. There will also be a section for each table to show its indexes. 

You can add all the objects from your database into your data dictionary, not just tables, depending on whether you want to add an explanation for each of those objects. 

You can use the description column on the tables to add explanations. For example, some of the columns in the batting table may need more explanations as to what they mean; for example, G means Games, while AB means At-bats. The data dictionary allows you to explain further, as shown in the following screenshot: 

There is a complete data dictionary in the code files you downloaded in the Technical requirements section of this chapter. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.240.222