CN106909570B - A data conversion method and device - Google Patents

A data conversion method and device Download PDF

Info

Publication number
CN106909570B
CN106909570B CN201510981357.7A CN201510981357A CN106909570B CN 106909570 B CN106909570 B CN 106909570B CN 201510981357 A CN201510981357 A CN 201510981357A CN 106909570 B CN106909570 B CN 106909570B
Authority
CN
China
Prior art keywords
data
conversion
field
source data
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510981357.7A
Other languages
Chinese (zh)
Other versions
CN106909570A (en
Inventor
宋忠平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Digital Service Technology Co ltd
Original Assignee
Advanced New Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201510981357.7A priority Critical patent/CN106909570B/en
Publication of CN106909570A publication Critical patent/CN106909570A/en
Application granted granted Critical
Publication of CN106909570B publication Critical patent/CN106909570B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种数据转换方法及装置。该数据转换方法用于将使用不同数据模型的源数据转换为使用统一需求数据模型的目标数据,该方法包括:获得待转换的源数据;读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段信息;根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。本申请技术方案与现有技术方案相比,不仅减少了转换逻辑的实现代码数量,而且将原本分散的多套数据转换逻辑集中在一起,从而有效降低了开发和维护成本。

Figure 201510981357

The present application discloses a data conversion method and device. The data conversion method is used to convert source data using different data models into target data using a unified demand data model. The method includes: obtaining the source data to be converted; reading the pre-stored conversion annotation of the source data corresponding to the data model The conversion annotation information at least includes: source data field information to be retained; according to the read conversion annotation information, the source data field to be retained is extracted from the source data to obtain target data. Compared with the prior art solution, the technical solution of the present application not only reduces the number of codes for implementing conversion logic, but also integrates multiple sets of data conversion logic that were originally scattered, thereby effectively reducing development and maintenance costs.

Figure 201510981357

Description

一种数据转换方法及装置A data conversion method and device

技术领域technical field

本申请涉及数据管理技术领域,尤其涉及一种数据转换方法及装置。The present application relates to the technical field of data management, and in particular, to a data conversion method and device.

背景技术Background technique

数据管理是指对各种数据进行收集、存储、处理和应用的过程,在大数据时代,为了应对显著增长的数据量,除了需要提供充足的存储空间之外,对数据管理技术也提出了更高的要求。Data management refers to the process of collecting, storing, processing and applying various kinds of data. In the era of big data, in order to cope with the significant increase in the amount of data, in addition to the need to provide sufficient storage space, data management technology has also been proposed. high demands.

对于数据存储方或数据使用方而言,往往需要从外部的数据源获取数据,而当外部数据源所提供的数据模型与实际使用所需的数据模型不一致时,就需要根据实际需求对从外部获取的数据进行转换处理,转换的内容可能包括对字段的取舍、字段名称的变更、字段类型的变更等等。For the data store or data user, it is often necessary to obtain data from an external data source, and when the data model provided by the external data source is inconsistent with the data model required for actual use, it needs to The acquired data is converted, and the content of the conversion may include the selection of fields, the change of field names, the change of field types, and so on.

实际应用中,从不同的外部数据源所获取的数据模型是五花八门的,根据现有技术的实现方案,为了满足统一的数据存储及使用需求,需要针对每种外部数据模型分别编写转换逻辑。在数据源数量较多的情况下,需要投入大量的开发及维护成本,而且在很多应用场景中,数据源的数量是在不断增加的,这也使得整体的开发及维护成本难以控制。In practical applications, various data models are obtained from different external data sources. According to the implementation scheme of the prior art, in order to meet unified data storage and usage requirements, it is necessary to write conversion logic for each external data model. In the case of a large number of data sources, a lot of development and maintenance costs need to be invested, and in many application scenarios, the number of data sources is constantly increasing, which also makes the overall development and maintenance costs difficult to control.

发明内容SUMMARY OF THE INVENTION

针对上述技术问题,本申请提供一种数据转换方法及装置,技术方案如下:In view of the above-mentioned technical problems, the application provides a data conversion method and device, and the technical scheme is as follows:

一种数据转换方法,用于将使用不同数据模型的源数据转换为使用统一需求数据模型的目标数据,该方法包括:A data conversion method for converting source data using different data models into target data using a unified demand data model, the method comprising:

获得待转换的源数据;Obtain the source data to be transformed;

读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段信息;Read the pre-stored conversion annotation information of the data model corresponding to the source data, where the conversion annotation information at least includes: source data field information to be retained;

根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。According to the read conversion annotation information, the source data fields that need to be retained are extracted from the source data to obtain the target data.

一种数据转换装置,用于将使用不同数据模型的源数据转换为使用统一需求数据模型的目标数据,该装置包括:A data conversion device for converting source data using different data models into target data using a unified demand data model, the device comprising:

源数据获得模块,用于获得待转换的源数据;The source data obtaining module is used to obtain the source data to be converted;

标注信息读取模块,用于读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段信息;An annotation information reading module, configured to read the pre-stored conversion annotation information of the data model corresponding to the source data, where the conversion annotation information at least includes: source data field information to be retained;

目标数据生成模块,用于根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。The target data generation module is configured to extract the source data fields that need to be retained from the source data according to the read conversion annotation information to obtain the target data.

本申请所提供的技术方案,通过预先对源数据模型进行标注的方式,为不同的源数据模型配置数据转换需求,在需要对源数据进行转换时,只需调用一套通用的、能够识别上述数据转换需求的逻辑,即可实现对使用不同数据模型的源数据进行统一转换。与现有技术方案相比,不仅减少了转换逻辑的实现代码数量,而且将原本分散的多套数据转换逻辑集中在一起,从而有效降低了开发和维护成本。The technical solution provided by this application configures data conversion requirements for different source data models by annotating the source data models in advance. The logic of data conversion requirements can realize unified conversion of source data using different data models. Compared with the prior art solution, it not only reduces the number of implementation codes of conversion logic, but also integrates originally scattered sets of data conversion logic, thereby effectively reducing development and maintenance costs.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not limiting of the present application.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments described in this application. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings.

图1是本申请的数据转换方法的流程示意图;Fig. 1 is the schematic flow chart of the data conversion method of the present application;

图2是本申请的数据转换装置的第一种结构示意图;Fig. 2 is the first structural representation of the data conversion device of the present application;

图3是本申请的数据转换装置的第二种结构示意图。FIG. 3 is a schematic diagram of the second structure of the data conversion apparatus of the present application.

具体实施方式Detailed ways

为了使本领域技术人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行详细地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于本申请保护的范围。In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be described in detail below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only It is a part of the embodiments of the present application, but not all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application shall fall within the protection scope of the present application.

为了解决针对使用多种数据模型分别开发转换逻辑的所带来的问题,本申请提供的方案是:根据应用需求,预先对各种源数据模型的字段进行标注,标注内容可以包括:需要保留哪些字段、是否需要改变字段名称,是否需要改变字段类型,等等。在需要对源数据进行转换时,只需调用一套通用的、能够识别上述数据转换需求的逻辑,即可实现对使用不同数据模型的源数据进行统一转换。In order to solve the problem of separately developing conversion logic using multiple data models, the solution provided by this application is: according to application requirements, the fields of various source data models are marked in advance, and the marked content may include: which ones need to be retained field, whether to change the field name, whether to change the field type, etc. When the source data needs to be transformed, it is only necessary to invoke a set of general logic that can identify the above data transformation requirements, and then the source data using different data models can be transformed uniformly.

图1所示,为本申请提供的数据转换方法的流程图,该方法可以包括以下步骤:As shown in Fig. 1, the flow chart of the data conversion method that this application provides, this method may comprise the following steps:

S101,获得待转换的源数据;S101, obtaining source data to be converted;

S102,读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段信息;S102: Read the pre-stored conversion annotation information of the data model corresponding to the source data, where the conversion annotation information at least includes: source data field information to be retained;

S103,根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。S103, according to the read conversion annotation information, extract the source data fields that need to be retained from the source data to obtain target data.

本申请所提供的数据转换方法,即对应于前述的通用数据转换逻辑,下面将结合具体的实例,对上述数据转换方法进行说明:The data conversion method provided by this application corresponds to the aforementioned general data conversion logic, and the above-mentioned data conversion method will be described below in conjunction with specific examples:

字段名称Field Name 字段描述field description 字段类型Field Type namename 姓名Name StringString ageage 年龄age LongLong birthdaybirthday 生日Birthday DateDate heightheight 身高height DoubleDouble

表1Table 1

字段名称Field Name 字段描述field description 字段类型Field Type namename 姓名Name StringString ageage 年龄age LongLong birthdaybirthday 生日Birthday DateDate teltel 电话号码phone number StringString

表2Table 2

表1和表2分别示出了两种不同的源数据模型的字段信息,其中数据模型1中包含了name、age、birthday、height四个字段,数据模型2中包含了name、age、birthday、tel四个字段。而在实际的应用需求中,仅需要使用name、age、birthday三个字段的数据。那么,根据本申请方案,可以预先对数据模型1和数据模型2的字段分别进行标注,得到两种数据模型的转换标注信息分别如表3和表4所示:Table 1 and Table 2 respectively show the field information of two different source data models, wherein data model 1 includes four fields of name, age, birthday, height, and data model 2 includes name, age, birthday, tel four fields. In actual application requirements, only the data of the three fields of name, age, and birthday need to be used. Then, according to the solution of the present application, the fields of the data model 1 and the data model 2 can be marked in advance, respectively, and the conversion marking information of the two data models can be obtained as shown in Table 3 and Table 4 respectively:

字段名称Field Name 字段描述field description 字段类型Field Type 标注callout namename 姓名Name StringString 11 ageage 年龄age LongLong 11 birthdaybirthday 生日Birthday DateDate 11 heightheight 身高height DoubleDouble 00

表3table 3

字段名称Field Name 字段描述field description 字段类型Field Type 标注callout namename 姓名Name StringString 11 ageage 年龄age LongLong 11 birthdaybirthday 生日Birthday DateDate 11 teltel 电话号码phone number StringString 00

表4Table 4

在表3和表4中,以“0”和“1”分别表示对应的字段是否保留在转换结果中,可以看出,表3中的“height”与表4中的“tel”字段均被标注为0,表示对应的字段不需要保留在转换结果中。标注完毕后,将每种模型的标注信息与源数据标识对应保存。In Table 3 and Table 4, "0" and "1" respectively indicate whether the corresponding field is retained in the conversion result. It can be seen that the "height" field in Table 3 and the "tel" field in Table 4 are both It is marked as 0, indicating that the corresponding field does not need to be preserved in the conversion result. After the labeling is completed, the labeling information of each model is stored corresponding to the source data identifier.

在转换阶段,假设传入基于数据模型1的源数据如表5所示:In the transformation phase, it is assumed that the incoming source data based on data model 1 is shown in Table 5:

namename ageage birthdaybirthday heightheight 张三Zhang San 3030 1980-12-121980-12-12 1.871.87 李四Li Si 2020 1990-01-121990-01-12 1.701.70 王五Wang Wu 1515 1995-08-121995-08-12 1.601.60

表5table 5

根据本申请所提供的数据转换方法,获得源数据之后,首先确定该数据使用的模型是数据模型1,进而读取数据模型1的转换标注信息,根据转换标注信息可以确定需要保留的字段包括name、age、birthday,分别提取这三个字段的数据后,得到目标数据如表6所示:According to the data conversion method provided by the present application, after obtaining the source data, first determine that the model used for the data is data model 1, and then read the conversion annotation information of data model 1. According to the conversion annotation information, it can be determined that the fields to be retained include name , age, birthday, after extracting the data of these three fields, the target data is obtained as shown in Table 6:

namename ageage birthdaybirthday 张三Zhang San 3030 1980-12-121980-12-12 李四Li Si 2020 1990-01-121990-01-12 王五Wang Wu 1515 1995-08-121995-08-12

表6Table 6

在上述实施例中,转换标注信息仅用于标识源数据的各个字段是否需要保留在转换结果中,也即默认不需要进行其他转换处理。而在实际的转换应用中,除了需要对源数据的字段进行取舍处理之外,可能还需要进行其他转换处理,例如对字段名称进行转换,对字段类型进行转换等等,应用本申请方案,可以通过对转换标注信息进行扩充以实现上述需求。In the above embodiment, the conversion annotation information is only used to identify whether each field of the source data needs to be retained in the conversion result, that is, no other conversion processing is required by default. In the actual conversion application, in addition to the selection processing of the fields of the source data, other conversion processing may also be required, such as field name conversion, field type conversion, etc. The above requirements are achieved by extending the transformation annotation information.

假设对数据模型1进行转换时,除了需要保留name、age、birthday三个字段外,为了与需求数据模型相适应,要求转换的目标数据三个字段的名称分别为“username”、“age”、“birthday”,字段类型分别为string、short、date,可以看出,原name字段的名称、原age字段的类型均发生了变化,上述需求可以通过表7所示的标注方式实现。Assume that when converting data model 1, in addition to retaining the three fields of name, age, and birthday, in order to adapt to the demand data model, the names of the three fields of the target data to be converted are "username", "age", "birthday", the field types are string, short, and date respectively. It can be seen that the name of the original name field and the type of the original age field have all changed. The above requirements can be achieved through the annotation methods shown in Table 7.

字段名称Field Name 字段描述field description 字段类型Field Type 标注callout namename 姓名Name StringString @Define(targetName="username"targetType=”String”)@Define(targetName="username" targetType="String") ageage 年龄age LongLong @Define(targetName="age"targetType=”Short”)@Define(targetName="age" targetType="Short") birthdaybirthday 生日Birthday DateDate @Define(targetName="birthday"targetType=”Date”)@Define(targetName="birthday" targetType="Date") heightheight 身高height DoubleDouble NullNull

表7Table 7

在表7中,除了转换后不需要保留的字段height(以Null进行标注)之外,对需要保留的3个字段均指定了转换后的目标字段名称targetName以及转换后的目标字段类型targetType,在实际进行数据转换时,先从源数据中提取需要保留的字段,然后按照指定的targetName以及targetType生成目标数据。In Table 7, except for the field height that does not need to be reserved after conversion (marked with Null), the converted target field name targetName and the converted target field type targetType are specified for the three fields that need to be reserved. In actual data conversion, the fields that need to be preserved are extracted from the source data, and then the target data is generated according to the specified targetName and targetType.

可以理解的是,除了在标注信息中指定目标字段名称、目标字段类型之外,还可以指定其他转换需求,例如计量单位的转换、数值的四舍五入处理,甚至调用特定的函数对源数据字段的数值进行处理,本领域技术人员可以根据实际需求对转换标注信息进行扩展。另外需要说明的是,本申请所提供的信息标注方式仅用于示意性说明,不应理解为对本申请方案的限制。It is understandable that in addition to specifying the target field name and target field type in the annotation information, other conversion requirements can also be specified, such as conversion of measurement units, rounding of numerical values, and even calling a specific function to the value of the source data field. After processing, those skilled in the art can expand the conversion annotation information according to actual needs. In addition, it should be noted that the information labeling method provided in this application is only for schematic illustration, and should not be construed as a limitation on the solution of this application.

在实际应用中,对源数据模型的标注可以通过简单的配置操作来实现,而所换取的收益是:仅用一套通用的转换逻辑,即可实现对使用不同数据模型的源数据进行统一转换,相对于现有的多套转换逻辑而言,开发成本明显降低;另外,在通用转换逻辑中,不仅减少了大量冗余代码,而且能够将原本分散的多套数据转换逻辑集中在一起,使得代码的可读性增强,更加易于维护。In practical applications, the annotation of source data models can be achieved through simple configuration operations, and the benefits in exchange are: only a set of general transformation logic can be used to achieve unified transformation of source data using different data models , compared with the existing multiple sets of conversion logic, the development cost is significantly reduced; in addition, in the general conversion logic, not only a large number of redundant codes are reduced, but also multiple sets of data conversion logic that were originally scattered can be concentrated together, making The code is more readable and easier to maintain.

生成目标数据之后,可以直接将所生成的数据转发给数据应用侧,也可以对所生成的数据进行存储。在本申请所提供的一种具体实施方式中,为了方便对数据进行统一存储,可以将目标数据保存为单值数据的形式。即每行都是单值数据。在这个单值数据中,需要体现出目标数据各个字段的键值对信息。具体而言,针对目标数据的每一行,需要将该行各字段名称以及对应数值写到一个字符串中,同时需要在字符串中提供分割标识以区分各个字段,这个字符串即为单值数据的数值。可选地,还可以在单值数据中添加字段的类型信息。After the target data is generated, the generated data can be directly forwarded to the data application side, or the generated data can be stored. In a specific implementation manner provided by this application, in order to facilitate unified storage of data, target data may be saved in the form of single-valued data. That is, each row is single-valued data. In this single-valued data, it is necessary to reflect the key-value pair information of each field of the target data. Specifically, for each row of the target data, it is necessary to write the field names and corresponding values of the row into a string, and at the same time, it is necessary to provide a segmentation identifier in the string to distinguish each field, and this string is single-valued data. value of . Optionally, type information of the field can also be added to the single-valued data.

实际应用中,在进行存储操作时,可以直接利用转换标注信息中的目标字段名称、目标字段类型等信息,赋予源数据的数值后得到需要存储的数据,例如,表8所示的3条数据,其中前4列是基于前述的数据模型1的源数据,根据表7所示的标注信息,最终保存的目标数据结果如表8最后一列所示:In practical applications, when performing a storage operation, you can directly use the target field name, target field type and other information in the conversion annotation information to give the value of the source data to obtain the data to be stored, for example, the three data shown in Table 8. , the first 4 columns are the source data based on the aforementioned data model 1. According to the label information shown in Table 7, the final result of the saved target data is shown in the last column of Table 8:

Figure BDA0000888180610000071
Figure BDA0000888180610000071

表8Table 8

采用上述数据保存方式,仅使用一个内容字段就可以存储任意类型、任意数量字段的数据内容,不仅维护方便,而且有效地精简了数据结构,提升了数据写入效率。后续在使用数据时,直接根据单值数据的生成规则,就可以还原得到具体的字段数值。With the above data storage method, data content of any type and any number of fields can be stored using only one content field, which is not only convenient for maintenance, but also effectively simplifies the data structure and improves the efficiency of data writing. When using the data subsequently, the specific field value can be restored directly according to the generation rules of the single-valued data.

相应于上述方法实施例,本申请还提供一种数据转换装置,参见图2所示,该装置可以包括:Corresponding to the above method embodiments, the present application further provides a data conversion apparatus, as shown in FIG. 2 , the apparatus may include:

源数据获得模块110,用于获得待转换的源数据;source data obtaining module 110, for obtaining source data to be converted;

标注信息读取模块120,用于读取预存的源数据对应数据模型的转换标注信息,其中,转换标注信息中至少包括:需要保留的源数据字段信息;The annotation information reading module 120 is configured to read the conversion annotation information of the data model corresponding to the pre-stored source data, wherein the conversion annotation information at least includes: source data field information to be retained;

目标数据生成模块130,用于根据所读取的转换标注信息,从源数据中提取需要保留的源数据字段,得到目标数据。The target data generation module 130 is configured to extract the source data fields that need to be retained from the source data according to the read conversion annotation information to obtain the target data.

在本申请的一种具体实施方式中,转换标注信息中还可以包括:需要保留的源数据字段转换后的目标字段名称;In a specific embodiment of the present application, the conversion annotation information may further include: the converted target field name of the source data field that needs to be retained;

相应地,目标数据生成模块130可以具体用于:根据所读取的转换标注信息,从源数据中提取需要保留的源数据字段,并将字段名称转换为对应的目标字段名称,得到目标数据。Correspondingly, the target data generation module 130 may be specifically configured to: extract the source data fields that need to be retained from the source data according to the read conversion annotation information, and convert the field names into corresponding target field names to obtain the target data.

在本申请的一种具体实施方式中,转换标注信息中还可以包括:需要保留的源数据字段转换后的目标字段类型;In a specific embodiment of the present application, the conversion annotation information may further include: the converted target field type of the source data field that needs to be retained;

相应地,目标数据生成模块130可以具体用于:根据所读取的转换标注信息,从源数据中提取需要保留的源数据字段,并将字段类型转换为对应的目标字段类型,得到目标数据。Correspondingly, the target data generation module 130 may be specifically configured to: extract the source data fields that need to be retained from the source data according to the read conversion annotation information, and convert the field types to the corresponding target field types to obtain the target data.

参见图3所示,在本申请的一种具体实施方式中,上述数据转换装置还可以包括保存模块140,用于将目标数据保存为单值数据,单值数据的数值中,携带该目标数据每个字段的键值对信息。Referring to FIG. 3 , in a specific embodiment of the present application, the above-mentioned data conversion apparatus may further include a saving module 140 for saving target data as single-valued data, and the value of the single-valued data carries the target data Key-value pair information for each field.

可选地,在单值数据的数值中,还可以携带该目标数据每个字段的字段类型信息。Optionally, the value of the single-valued data may also carry field type information of each field of the target data.

上述装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For details of the implementation process of the functions and functions of each module in the above-mentioned device, please refer to the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例或者实施例的某些部分所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products can be stored in storage media, such as ROM/RAM, magnetic disks , CD-ROM, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present application.

本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本申请方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。The various embodiments in this specification are described in a progressive manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the apparatus embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for related parts. The device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated. When implementing the solution of the present application, the functions of each module may be integrated into one or more modules. implemented in software and/or hardware. Some or all of the modules may also be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.

以上所述仅是本申请的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only specific embodiments of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can also be made. It should be regarded as the protection scope of this application.

Claims (10)

1.一种数据转换方法,应用于数据收集方,用于调用一套通用的逻辑将使用不同数据模型的源数据转换为使用统一需求数据模型的目标数据,预先存储对应于不同数据模型的不同转换标注信息,以使不同数据模型转换为同一数据模型,其特征在于,该方法包括:1. A data conversion method, applied to the data collector, used to call a set of general logic to convert source data using different data models into target data using a unified demand data model, and pre-store different data corresponding to different data models. Converting the annotation information to convert different data models into the same data model, characterized in that the method includes: 获得待转换的源数据;Obtain the source data to be transformed; 读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段名称和字段类型;Reading the pre-stored conversion annotation information of the data model corresponding to the source data, the conversion annotation information at least includes: the source data field name and field type to be retained; 根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。According to the read conversion annotation information, the source data fields that need to be retained are extracted from the source data to obtain the target data. 2.根据权利要求1所述的方法,其特征在于,所述转换标注信息中还包括:需要保留的源数据字段转换后的目标字段名称;2. The method according to claim 1, wherein the conversion annotation information further comprises: the target field name after the conversion of the source data field that needs to be retained; 所述根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据,包括:根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,并将字段名称转换为对应的目标字段名称,得到目标数据。Extracting the source data fields that need to be retained from the source data according to the read conversion annotation information to obtain the target data includes: according to the read conversion annotation information, extracting from the source data the fields that need to be retained. source data field, and convert the field name to the corresponding target field name to obtain the target data. 3.根据权利要求1所述的方法,其特征在于,所述转换标注信息中还包括:需要保留的源数据字段转换后的目标字段类型;3. The method according to claim 1, wherein the conversion annotation information further comprises: the target field type after the conversion of the source data field that needs to be retained; 所述根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据,包括:根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,并将字段类型转换为对应的目标字段类型,得到目标数据。Extracting the source data fields that need to be retained from the source data according to the read conversion annotation information to obtain the target data includes: according to the read conversion annotation information, extracting from the source data the fields that need to be retained. The source data field, and the field type is converted to the corresponding target field type to obtain the target data. 4.根据权利要求1所述的方法,其特征在于,所述方法还包括:4. The method according to claim 1, wherein the method further comprises: 将所述目标数据保存为单值数据,所述单值数据的数值中,携带该目标数据每个字段的键值对信息。The target data is saved as single-valued data, and the value of the single-valued data carries key-value pair information of each field of the target data. 5.根据权利要求4所述的方法,其特征在于,所述单值数据的数值中,还携带该目标数据每个字段的字段类型信息。5 . The method according to claim 4 , wherein the value of the single-valued data further carries field type information of each field of the target data. 6 . 6.一种数据转换装置,应用于数据收集方,用于调用一套通用的逻辑将使用不同数据模型的源数据转换为使用统一需求数据模型的目标数据,预先存储对应于不同数据模型的不同转换标注信息,以使不同数据模型转换为同一数据模型,其特征在于,该装置包括:6. A data conversion device, applied to a data collector, used to call a set of general logic to convert source data using different data models into target data using a unified demand data model, and pre-store different data corresponding to different data models. Converting annotation information to convert different data models into the same data model, characterized in that the device includes: 源数据获得模块,用于获得待转换的源数据;The source data obtaining module is used to obtain the source data to be converted; 标注信息读取模块,用于读取预存的所述源数据对应数据模型的转换标注信息,所述转换标注信息中至少包括:需要保留的源数据字段名称和字段类型;An annotation information reading module, configured to read the pre-stored conversion annotation information of the data model corresponding to the source data, where the conversion annotation information at least includes: source data field names and field types to be retained; 目标数据生成模块,用于根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,得到目标数据。The target data generation module is configured to extract the source data fields that need to be retained from the source data according to the read conversion annotation information to obtain the target data. 7.根据权利要求6所述的装置,其特征在于,所述转换标注信息中还包括:需要保留的源数据字段转换后的目标字段名称;7. The device according to claim 6, wherein the conversion annotation information further comprises: the target field name after the conversion of the source data field that needs to be retained; 所述目标数据生成模块,具体用于:根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,并将字段名称转换为对应的目标字段名称,得到目标数据。The target data generation module is specifically configured to: extract the source data fields that need to be retained from the source data according to the read conversion annotation information, and convert the field names into corresponding target field names to obtain target data. 8.根据权利要求6所述的装置,其特征在于,所述转换标注信息中还包括:需要保留的源数据字段转换后的目标字段类型;8. The device according to claim 6, wherein the conversion annotation information further comprises: the target field type after the conversion of the source data field that needs to be retained; 所述目标数据生成模块,具体用于:根据所读取的转换标注信息,从所述源数据中提取需要保留的源数据字段,并将字段类型转换为对应的目标字段类型,得到目标数据。The target data generation module is specifically configured to: extract the source data fields to be retained from the source data according to the read conversion annotation information, and convert the field types to corresponding target field types to obtain target data. 9.根据权利要求6所述的装置,其特征在于,所述装置还包括:9. The apparatus of claim 6, wherein the apparatus further comprises: 保存模块,用于将所述目标数据保存为单值数据,所述单值数据的数值中,携带该目标数据每个字段的键值对信息。The saving module is used for saving the target data as single-valued data, and the value of the single-valued data carries the key-value pair information of each field of the target data. 10.根据权利要求9所述的装置,其特征在于,所述单值数据的数值中,还携带该目标数据每个字段的字段类型信息。10 . The apparatus according to claim 9 , wherein the value of the single-valued data further carries field type information of each field of the target data. 11 .
CN201510981357.7A 2015-12-23 2015-12-23 A data conversion method and device Active CN106909570B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510981357.7A CN106909570B (en) 2015-12-23 2015-12-23 A data conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510981357.7A CN106909570B (en) 2015-12-23 2015-12-23 A data conversion method and device

Publications (2)

Publication Number Publication Date
CN106909570A CN106909570A (en) 2017-06-30
CN106909570B true CN106909570B (en) 2020-12-15

Family

ID=59200046

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510981357.7A Active CN106909570B (en) 2015-12-23 2015-12-23 A data conversion method and device

Country Status (1)

Country Link
CN (1) CN106909570B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109346163A (en) * 2018-12-21 2019-02-15 邬超 Data transfer device, equipment and system
CN113704650A (en) * 2020-05-21 2021-11-26 阿里巴巴集团控股有限公司 Information display method, device, system, equipment and storage medium
CN115686494A (en) * 2022-10-28 2023-02-03 零氪科技(北京)有限公司 Design method, device, electronic equipment and storage medium of patient interaction bullet box

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102629263A (en) * 2012-02-29 2012-08-08 上海安捷力信息系统有限公司 Method and system for format conversion of interactive business data among enterprises
CN103970905A (en) * 2014-05-27 2014-08-06 重庆大学 Automatic composition and integration method for multi-source vector geographic information data
CN104662535A (en) * 2012-07-24 2015-05-27 起元科技有限公司 Mapping entities in data models

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247589B (en) * 2007-07-04 2010-09-08 华为技术有限公司 Mobile terminal data conversion/backup method, device and system
CN101196927A (en) * 2007-12-29 2008-06-11 中国建设银行股份有限公司 Data mapping method and device thereof
US9015608B2 (en) * 2012-07-16 2015-04-21 Sap Se Regenerating a user interface area
US9418124B2 (en) * 2013-12-16 2016-08-16 International Business Machines Corporation System and method of integrating time-aware data from multiple sources

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102629263A (en) * 2012-02-29 2012-08-08 上海安捷力信息系统有限公司 Method and system for format conversion of interactive business data among enterprises
CN104662535A (en) * 2012-07-24 2015-05-27 起元科技有限公司 Mapping entities in data models
CN103970905A (en) * 2014-05-27 2014-08-06 重庆大学 Automatic composition and integration method for multi-source vector geographic information data

Also Published As

Publication number Publication date
CN106909570A (en) 2017-06-30

Similar Documents

Publication Publication Date Title
US20210109934A1 (en) Configurable and incremental database migration framework for heterogeneous databases
US9619492B2 (en) Data migration
CN104462269A (en) Isomerous database data exchange method and system
CN102789491B (en) A kind of configurable data subscription and delivery system and method thereof
CN102982127B (en) Batch substitute character string realizes method and the batch-processed devices of multi-lingual version
WO2019095424A1 (en) Data acquisition method and device, storage medium and terminal
TW200939052A (en) Dynamic formulas for spreadsheet cells
CN106326243A (en) Data processing method and apparatus
CN110555073A (en) A data processing method, device, electronic equipment, and storage medium
CN105488210B (en) A kind of batch data matching process and device
CN111858730A (en) A data import and export device, method, device and medium for graph database
CN106909570B (en) A data conversion method and device
CN107992492A (en) A kind of storage method of data block, read method, its device and block chain
CN103440197B (en) A Method of Automatically Generating Difference Test Report Based on Contrast Test
CN106886390B (en) Java object generation and conversion method and Java object generation and conversion device
CN106095809B (en) Data matching method and system
CN107203525B (en) Database processing method and device
CN107832443A (en) Method, device and medium for processing JSON document data
CN115035017A (en) Cell density grouping method, device, electronic apparatus and storage medium
CN106776779B (en) Method for generating entity file by JSON data based on Mac platform
CN104991776A (en) A method of reading and writing excel based on configuration
CN108073705B (en) Distributed mass data aggregation acquisition method
CN110659998A (en) Data processing method, data processing apparatus, computer apparatus, and storage medium
CN111401005B (en) Text conversion method, device and readable storage medium
CN108038182A (en) A kind of method and apparatus of the relation data library storage data based on Flume

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200923

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220330

Address after: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province

Patentee after: Alipay (Hangzhou) Information Technology Co.,Ltd.

Address before: Ky1-9008 Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands, ky1-9008

Patentee before: Innovative advanced technology Co.,Ltd.

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 310000 Zhejiang Province, Hangzhou City, Xihu District, Xixi Road 543-569 (continuous odd numbers) Building 1, Building 2, 5th Floor, Room 518

Patentee after: Alipay (Hangzhou) Digital Service Technology Co.,Ltd.

Country or region after: China

Address before: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province

Patentee before: Alipay (Hangzhou) Information Technology Co., Ltd.

Country or region before: China