自动填充数据新增测试数据

In this article, we will examine the process of populating the employee database with dummy data, whose schema we designed in the previous article. Filling a SQL database with dummy data can be very useful when we want to run some tests. The most convenient way is the population of SQL tables with random data with the help of visual data generation tools.

在本文中,我们将研究用虚假数据填充员工数据库的过程,虚假数据是我们在上一篇文章中设计的。 当我们要运行一些测试时,用伪数据填充SQL数据库可能非常有用。 最方便的方法是借助可视数据生成工具来填充具有随机数据SQL表。

借助Data Generator for SQL Server生成数据 (Generating data with the help of Data Generator for SQL Server)

For this purposes we’ll use Data Generator for SQL Server tool which is integrated into SSMS and is also included in dbForge Studio. It should be noted that realistic test data is generated based on column names, dimensions, and data types. Apart from this, the relationships between tables are also taken into account, as the process of data generation depends on them.

为此,我们将使用SQL Server的数据生成器工具,该工具已集成到SSMS中,并且也包含在dbForge Studio中 。 应该注意的是,真实的测试数据是根据列名,维度和数据类型生成的。 除此之外,表之间的关系也要考虑在内,因为数据生成的过程取决于它们。

To open this component, right-click “New Data Generation…” on the necessary database in SSMS:

要打开此组件,请在SSMS的必要数据库上右键单击“ New Data Generation…”:

Img. 1. Running the Data Generator for SQL Server tool in SSMS
图 1.在SSMS中运行SQL Server的数据生成器工具

If you are using dbForge Studio, in the main menu, choose Tools\New Data Generation…:

如果使用的是dbForge Studio,请在主菜单中选择“工具\新数据生成...”:

Img.2. Running the Data Generator for SQL Server tool in dbForge Studio
图2。 在dbForge Studio中运行SQL Server的数据生成器工具

In the resulting window, on the “Connection” tab, you can see the current MS SQL Server instance and the database selected for data generation, which can be edited (if necessary). Then click the “Next” button:

在出现的窗口中,在“连接”选项卡上,您可以看到当前的MS SQL Server实例以及为生成数据而选择的数据库,可以对其进行编辑(如有必要)。 然后点击“下一步”按钮:

Img.3. Setting the “Connection” tab
图3。 设置“连接”标签

Next, on the “Options” tab, let’s set the options of data generation for the database:

接下来,在“选项”选项卡上,让我们设置数据库的数据生成选项:

Img.4. Setting data generation options
图4。 设置数据生成选项

Note that you can generate SQL test data in different modes:

请注意,您可以采用不同的方式生成SQL测试数据:

  1. By specified number of rows (1000 rows by default)按指定的行数(默认为1000行)
  2. By proportion of existing data in the volume of percent (10 % by default)按现有数据占百分比的比例(默认为10%)
  3. By generation of data by time (10 seconds by default)按时间生成数据(默认为10秒)

You can also clear data before generation by setting the “Truncate data from table before generation” parameter.

您还可以通过设置“在生成之前从表中截断数据”参数来生成之前清除数据。

You can set the value distribution mode in one of the following ways:

您可以通过以下方式之一设置值分配模式:

  1. Random by timestamp按时间戳随机
  2. Random by seed (1 by default)按种子随机(默认为1)
  3. Sequential顺序的

Also, you can set column properties:

另外,您可以设置列属性:

  1. Set values to be unique将值设置为唯一
  2. Include NULL values (10% of rows by default)包含NULL值(默认为行的10%)
  3. Include empty values (10% of rows by default)包含空值(默认情况下为行的10%)

You can save the settings to a .bat file by pressing the “Save Command Line…” button located on the lower left of the data generation settings window.

您可以通过按数据生成设置窗口左下角的“保存命令行...”按钮将设置保存到.bat文件。

After you are finished with the settings, on the lower right of the data generation settings window, press the “Open” button.

设置完成后,在数据生成设置窗口的右下角,按“打开”按钮。

You will then see a progress bar showing the table metadata loading. After that, the window with detailed data generation settings for each selected table appears:

然后,您将看到显示表元数据加载的进度条。 之后,将出现一个窗口,其中包含每个选定表的详细数据生成设置:

Img.5. Detailed data generation settings for each selected table
图5。 每个选定表的详细数据生成设置

On the left, you should select the tables and columns you want to populate, and on the right, you should set the table generation mode for the selected table.

在左侧,应选择要填充的表和列,在右侧,应为所选表设置表生成模式。

At the same time, below are the instances of generated data (note that they represent real names).

同时,下面是生成的数据的实例(请注意,它们代表真实姓名)。

In the top right corner, there is a button of data generation settings that were described above.

在右上角,有一个上述数据生成设置的按钮。

To start the data generation process, click on the green arrow at the top center of the window. Then, you will see the window for selecting additional settings. Here, on the Output tab, you need to select exactly where to generate the data, in the form of a script, save it to a file or to a database. Let us select the last option and press Next:

要开始数据生成过程,请单击窗口顶部中心的绿色箭头。 然后,您将看到用于选择其他设置的窗口。 在这里,您需要在“输出”选项卡上以脚本的形式精确选择生成数据的位置,然后将其保存到文件或数据库中。 让我们选择最后一个选项,然后按Next:

Img. 6. Setting the “Output” tab
图 6.设置“输出”选项卡

Then, you can set additional parameters on the Options tab. In this case, you need to uncheck database backup options and press “Next”:

然后,您可以在“选项”选项卡上设置其他参数。 在这种情况下,您需要取消选中数据库备份选项,然后按“下一步”:

Img.7. Setting the “Options” tab
图7。 设置“选项”标签

On the “Additional Scripts” tab, you can set additional scripts. In our case, we just press “Next”:

在“其他脚本”选项卡上,可以设置其他脚本。 在我们的情况下,我们只需按“下一步”:

Img.8. Setting the “Additional Scripts” tab
图8。 设置“其他脚本”选项卡

On the “Summary” tab, we can see the information about settings and also warnings. Here, you can also save all settings as a .bat file, by pressing the bottom left “Save Command Line…” button. To run the data generation process, you need to press the “Generate” button:

在“摘要”选项卡上,我们可以看到有关设置和警告的信息。 在这里,您还可以通过按左下角的“保存命令行...”按钮将所有设置另存为.bat文件。 要运行数据生成过程,您需要按“ Generate”按钮:

Img.9. The general information and warnings on the Summary tab
图9。 摘要选项卡上的常规信息和警告

The window of data generation process appears:

出现数据生成过程窗口:

Img.10. Data generation process
图10。 数据生成过程

Then, the tables will be populated with data. For instance, the Employee table has the following generated data:

然后,将在表中填充数据。 例如,Employee表具有以下生成的数据:

Img.11. The examples of generated data in the Employee table
图11。 Employee表中生成的数据的示例

结论 (Conclusions)

To sum up, we populated the database with realistic data for testing both functionality and load. It is possible to generate much more random data for load tests. In addition to that, the very process of testing can be accelerated by means of the dbForge Unit Test tool.

综上所述,我们在数据库中填充了用于测试功能和负载的实际数据。 可以为负载测试生成更多随机数据。 除此之外,还可以通过dbForge单元测试工具来加速整个测试过程。

What is more, through the use of SQL data generation, you can calculate not only a database growth rate but also a query performance difference that results from the data volume increase.

而且,通过使用SQL数据生成,您不仅可以计算数据库增长率,还可以计算由于数据量增加而导致的查询性能差异。

Originally published at https://blog.devart.com on July 22, 2020.

最初于 2020年7月22日 发布在 https://blog.devart.com 上。

翻译自: https://towardsdatascience.com/populating-the-employee-database-with-test-data-aa76419eebb6

自动填充数据新增测试数据


http://www.taodudu.cc/news/show-863578.html

相关文章:

  • bart使用方法_使用简单变压器的BART释义
  • 卷积网络和卷积神经网络_卷积神经网络的眼病识别
  • 了解回归:迈向机器学习的第一步
  • yolo yolov2_PP-YOLO超越YOLOv4 —对象检测的进步
  • 机器学习初学者_绝对初学者的机器学习
  • monk js_对象检测-使用Monk AI进行文档布局分析
  • 线性回归 c语言实现_C ++中的线性回归实现
  • 忍者必须死3 玩什么忍者_降维:忍者新手
  • 交叉验证和超参数调整:如何优化您的机器学习模型
  • 安装好机器学习环境的虚拟机_虚拟环境之外的数据科学是弄乱机器的好方法
  • 遭遇棘手 交接_Librosa的城市声音分类-棘手的交叉验证
  • 模型越复杂越容易惰性_ML模型的惰性预测
  • vgg 名人人脸图像库_您看起来像哪个名人? 图像相似度搜索模型
  • 机器学习:贝叶斯和优化方法_Facebook使用贝叶斯优化在机器学习模型中进行更好的实验
  • power-bi_在Power BI中的VertiPaq内-压缩成功!
  • 模型 标签数据 神经网络_大型神经网络和小数据的模型选择
  • 学习excel数据分析_为什么Excel是学习数据分析的最佳方法
  • 护理方面关于人工智能的构想_如何提出惊人的AI,ML或数据科学项目构想。
  • api数据库管理_API管理平台如何增强您的数据科学项目
  • batch lr替代关系_建立关系的替代方法
  • ai/ml_您本周应阅读的有趣的AI / ML文章(8月9日)
  • snowflake 使用_如何使用机器学习模型直接从Snowflake进行预测
  • 统计 python_Python统计简介
  • ios 图像翻转_在iOS 14中使用计算机视觉的图像差异
  • 熔池 沉积_用于3D打印的AI(第3部分):异常熔池分类的纠缠变分自动编码器
  • 机器学习中激活函数和模型_探索机器学习中的激活和丢失功能
  • macos上的硬盘检测工具_如何在MacOS上使用双镜头面部检测器(DSFD)实现90%以上的精度
  • 词嵌入应用_神经词嵌入的法律应用
  • 谷歌 colab_使用Google Colab在Python中将图像和遮罩拆分为多个部分
  • 美国人口普查年收入比赛_训练网络对收入进行分类:成人普查收入数据集

自动填充数据新增测试数据_用测试数据填充员工数据库相关推荐

  1. 后端返回数据带有标签_越来越火的图数据库究竟是什么?是否在制造企业可以应用...

    随着社交.电商.金融.零售.物联网等行业的快速发展,现实社会织起了了一张庞大而复杂的关系网,传统数据库很难处理关系运算.大数据行业需要处理的数据之间的关系随数据量呈几何级数增长,亟需一种支持海量复杂数 ...

  2. 加载mySQL数据到内存_【测试验证】数据库加载到内存占用大小

    介绍 数据库大小加载到内存占用是不是数据库的本身大小哪?今天忽然突发奇想于是就测试一下.首先我要说明的是我是在EF框架下进行测试的,不知道会不会与ado.net连接方式差生不同的结果,我仅仅是做记录, ...

  3. 在数据库技术中脏数据是指_数据库安全关键技术之数据库加密技术

    数据库加密作为近年来兴起的数据库安防技术,已经被越来越多的人所重视.这种基于存储层加密的防护方式,不仅可以有效解决数据库明文存储引起的泄密风险,也可以防止来自内部或者外部的入侵及越权访问行为. 从技术 ...

  4. mysql500万数据查询速度_是什么影响了数据库查询速度

    一.什么影响了数据库查询速度 1.1 影响数据库查询速度的四个因素 1.2 风险分析 QPS:Queries Per Second意思是"每秒查询率",是一台服务器每秒能够相应的查 ...

  5. 数据库单表数据过亿_我也能写数据库 —— 单表查询

    前言 说不定期更新,就不定期更新:). 在翻译关系代数这篇文档的时候,总有一种惴惴不安的感觉伴随着我,其实还是对之前概览的一知半解,而DEMO项目Calcite-example-CSV为了介绍特性,添 ...

  6. python删除数据库的数据完整代码_轻松掌握Python对数据库的增、删、改、查

    上节课我们讲解了Python操作数据库的一些基础内容,并带大家搭建了基础运行环境.安装了MySQL依赖包,并且我们还连接数据库做了查询操作. 如果没有学习上篇文章的同学建议回顾一下:全栈:Centos ...

  7. java读取excrl模板填充数据,spring mvc 读取excel模板填充数据下载

    需求: 将订单信息导出到excel中,存在excel模板,需要向其中添加数据. 技术选型: 对于excel操作,使用apache poi包.到maven repository找poi最新的发行包. 搜 ...

  8. mysql数据备份方法_最快的MySql数据库备份方法

    最快的MySql数据库备份方法 使用MYSQL进行数据库备份,又很正规的数据库备份方法,同其他的数据库服务器有相同的概念,但有没有想过,MySQL会有更简捷的使用文件目录的备份方法,而且又快有好. 一 ...

  9. mysql数据库插入数据为空_用java向mysql数据库中插入数据为空

    利用java面向对像编程,向数据库中插入数据时.遇到插入的数据为空的情况.在此做一小结: 1.数据库连接正正常 2.sql语句没有问题 3.程序没有报异常 4.代码: import java.util ...

最新文章

  1. class没有发布到tomcat_基于Tomcat的Websocket范例及permessage-deflate扩展特性的研究
  2. 利用LSM实现更安全的linux
  3. ACM Doing Homework again
  4. 贺MSDN中文站开通测试!
  5. Socket 之 API函数介绍
  6. ADF:将UI类别与动态表单一起使用
  7. 金和oa:自定义表单函数计算一段时期内的工作日
  8. Texlive中jpg和pdf转成eps
  9. 数据太多加滚动标题不动_音乐数据挖掘导引(四)
  10. web app 自适应方案总结 弹性布局之rem
  11. linux centos网卡配置,centos网卡配置详解
  12. asp.net中后台javaScrip的使用
  13. 3月28日 simulink学习(一)
  14. stc单片机c语言编程软件,stc isp官方下载-STC单片机ISP下载编程软件下载v6.85i 官方最新版-西西软件下载...
  15. 开普勒方程迭代求解C语言,一种实用的开普勒方程求解方法及其 C 语言实现
  16. 读后感----我奋斗了18年还是不能和你坐在一起喝咖啡
  17. Java导出多个excel并压缩下载
  18. mac SCp上传文件到阿里云服务器centos
  19. Transformer 和卷积神经网络在跨物种基因组DNA N6甲基腺嘌呤位点识别中的应用
  20. Statement与PreparedStatement

热门文章

  1. ConstraintLayout 学习笔记
  2. YUIDoc example代码高亮错误、生成API文档目录不按源文件注释顺序
  3. Xampp里Mysql服务启动不起来,错误1067
  4. 行、重复-SAP HANA 集合操作 UNION/Union all/INTERSECT/EXCEPT (SAP HANA Set Operations)-by小雨...
  5. 英特尔ARM开启芯片之战 消费者该何去何从?
  6. (原创)无废话C#设计模式之二十二:总结(针对GOF23)
  7. 数据仓库中两种数据模型的分析比较
  8. java fx dialog_JavaFX 如何使用內建的對話框(Dialog)?
  9. 2008一打开项目就闪退_UE4[C++]项目编译相关的坑
  10. The Best Vacation CodeForces - 1358D(贪心+尺取)