简体   繁体   English

两种不同数据库模式之间的数据映射

[英]Data Mapping between two different Database Schemas

I have to design a system with an sql database whose work is to get data from different databases which may be in another database such as mysql or oracle etc. Then the system will map the attributes of that database with my database schema and store them.. Example reference link: https://msdn.microsoft.com/en-us/library/aa728893(v=vs.71).aspx Since I am new, I can't attach images which is why I am providing links. 我必须设计一个带有sql数据库的系统,该数据库的工作是从可能位于另一个数据库(例如mysql或oracle等)中的不同数据库中获取数据。然后,系统将使用我的数据库模式映射该数据库的属性并将其存储。参考示例链接: https : //msdn.microsoft.com/zh-cn/library/aa728893(v=vs.71).aspx由于我是新手,所以无法附加图像,这就是我提供链接的原因。

All my searches end up with getting the mapping tools but what actually I want is how to create that tool myself. 我所有的搜索最终都获得了映射工具,但是我真正想要的是如何自己创建该工具。 I am not a professional but a little push will be enough for me and highly appreciated. 我不是专业人士,但稍加推动便足以使我受到高度赞赏。 Thanks in advance. 提前致谢。

Please, ignore for this task, any form of programming, Do not do it. 请忽略此任务的任何形式的编程,不要这样做。 Especially ignore Entity framework. 特别是忽略实体框架。

I would recommend you to take one of the many ETL tools out there, and design the work with it. 我建议您使用众多ETL工具之一,并设计使用它的工作。 I can recommend you Talend . 我可以推荐你塔伦德 It is very easy to learn and in time, even a developer starts to work with it. 它非常容易学习,而且即使是开发人员也可以及时使用它。 The best part about it that it can connect to webservices, enterprise solutions and probably any imaginable Database out there. 它最好的部分是它可以连接到Web服务,企业解决方案以及可能存在的任何可想象的数据库。

What you do is to design Jobs that run on its own in parallel, and then you export the jobs as standalone JARs. 您要做的是设计可并行运行的Job,然后将其导出为独立的JAR。 A chroneJob, or a scheduled service completes the process to have it executed periodically chroneJob或计划的服务完成该过程以使其定期执行

This, as I said in the comment, sounds to me a job for an Integration Services package. 就像我在评论中说的那样,这听起来对我来说是Integration Services软件包的工作。

If you would like to use Microsoft SQL Server Integration Services you should first have Microsoft SQL Server Data Tools installed on your development machine. 如果要使用Microsoft SQL Server集成服务,则应首先在开发计算机上安装Microsoft SQL Server数据工具

Afterwards you start by creating a new Integration Service project inside Visual Studio. 之后,您首先在Visual Studio中创建一个新的Integration Service项目。 Then you can add an ODBC Connection Manager to manage your different databases input of data. 然后,您可以添加ODBC连接管理器来管理不同数据库的数据输入。 After that you can add a different transformation container objects in your package to transform the data as you need it. 之后,您可以在包中添加其他转换容器对象,以根据需要转换数据。 At the end you need to specify the output of all those elements into your database where you want to store the information that you collect from other sources. 最后,您需要将所有这些元素的输出指定到数据库中,您要在其中存储从其他来源收集的信息。

You can also create a different package for every source database you have so that the tasks can be separated. 您还可以为您拥有的每个源数据库创建一个不同的包,以便可以分离任务。 Unfortunately a complete tutorial is very long for me to post here but you can check out the tutorial on Microsoft web site . 不幸的是,完整的教程对我来说太长了,但您可以在Microsoft网站上查看该教程。 An other example here . 这里的另一个例子。

As as warning you should be really careful with data types because if you don't match/convert them correctly the package will fail with not so obvious errors. 作为警告,您应该非常小心数据类型,因为如果您不正确地匹配/转换它们,则包将失败,并不会出现明显的错误。

If you choose the .tt (T4 Template) solution in which you create the application then you should start by connecting to the sources database and loop through tables definitions to get the columns and then store them as a xml file. 如果选择在其中创建应用程序的.tt (T4模板)解决方案,则应首先连接到源数据库并遍历表定义以获取列,然后将其存储为xml文件。 The matching you will have to do it inside the text template file so that you have the matching already done when the table is read from the data source. 您必须在文本模板文件中进行匹配,以便从数据源读取表时已经进行了匹配。

Here is an example that should get you started. 是一个应该让您入门的示例。 Note that in the example the output file will be a .cs file not .xml but you can configure that very easily with this T4 directive <#@ output extension=".xml" #> . 请注意,在示例中,输出文件将是.cs文件而不是.xml,但您可以使用此T4指令<#@ output extension=".xml" #>轻松配置该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在两个不同的数据库中的两个表之间同步数据 - How to sync data between two table in two different database 使用代码在不同模式中的两个表之间进行实时映射 - Realtion mapping between two tables in different schema with code first 具有两个数据库的实体框架(完全不同的架构) - entity framework with two databases (completely different schemas ) 不同 DbContext 和不同模式之间的实体框架关系 - Entity Framework relationships between different DbContext and different schemas 数据在不同窗口中的两个TextBox之间绑定 - Data Binding between two TextBoxes in different windows 聚合来自两个不同数据库上下文的数据 - Aggregate data from two different database contexts 不同数据类型之间的自动映射器映射 - Automapper mapping between different datatypes Automapper:不同类型之间的映射 - Automapper: mapping between different types 在仅名称空间不同的两个模式之间转换XML文档 - Transforming XML document between two schemas differing only in namespaces DDD - 有界上下文中实体的一致性和数据库中的不同模式 - DDD - Consistency of Entity Across Bounded Context & Different Schemas in Database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM