简体   繁体   English

具有自动代码创建功能的 MDS 登台

[英]MDS Staging with automatic codes creation

everyone!每个人!

We're using MS SQL Master Data Services to organize our enterprise master data and some of entities, we keep, consists of data, that we load from external sources almost as-is.我们使用 MS SQL 主数据服务来组织我们的企业主数据和一些实体,我们保留,由数据组成,我们几乎按原样从外部源加载这些数据。 We regularly update them using jobs or SSIS packages, placing data into staging tables ( [stg].[<name>_Leaf] ) and starting staging process using procedures, named as [stg].[udp_<name>_Leaf] as described in THIS and THIS topics about staging process in MDS.我们使用作业或 SSIS 包定期更新它们,将数据放入暂存表 ( [stg].[<name>_Leaf] ) 并使用命名为[stg].[udp_<name>_Leaf]过程启动暂存过程,如中所述THISTHIS关于 MDS 中的暂存过程的主题。

Sometimes data, we import from some external source is presented as a flat table, just containing a set of rows, that we might want to reference in our other tables and then we load it and enjoy (in fact we place data into staging tables, call SP and let MDS proceed it in any, comfortable for server, moment, due to the main workload of staging process is running asynchronously, via Broker).有时,我们从某些外部源导入的数据显示为一个平面表,只包含一组行,我们可能希望在其他表中引用这些行,然后我们加载它并享受(实际上我们将数据放入临时表中,调用 SP 并让 MDS 以任何方式处理它,这对服务器来说很舒服,因为暂存过程的主要工作负载是通过 Broker 异步运行)。

But there are a lot of other, ugly, but real-life cases, when data, that we load is presented as a tree, containing references to members, that we've not loaded yet and just going to place them into staging tables.但是还有很多其他的、丑陋的、但真实的情况,当我们加载的数据以树的形式呈现时,包含对成员的引用,我们还没有加载,只是将它们放入临时表中。

The problem is that in most cases we use automatic code creation function (and we cannot use not surrogate code), and we're not able to set member referencing's field value (where referenced's member code must be placed) to newly created member, before member is created and inserted into the base table and code is generated and set.问题是在大多数情况下我们使用自动代码创建功能(并且我们不能使用非代理代码),并且我们无法将成员引用的字段值(必须放置被引用的成员代码的位置)设置为新创建的成员,之前成员被创建并插入到基表中,代码被生成和设置。

As I can see, we could resolve this problem, if we could reference staging member by staging table's ID, which is IDENTITY and assigned right after insert.如我所见,如果我们可以通过暂存表的 ID(即 IDENTITY 并在插入后立即分配)来引用暂存成员,我们就可以解决这个问题。

-OR- -或者-

If we could receive a callback from the staging process when data is placed into our base tables and codes are assigned.当数据被放入我们的基表并分配代码时,我们是否可以从登台过程接收回调。 Then we'd calculate all references and update them (using the same staging process mech).然后我们将计算所有引用并更新它们(使用相同的暂存过程机制)。

Currently, we use目前,我们使用stupid愚蠢的not-very-elegant workaround, generating GUIDs and using them as Code value, when this scenario is.在这种情况下,不太优雅的解决方法,生成 GUID 并将它们用作代码值。

Can anyone offer anything more enterprise?谁能提供更多的企业? (: (:

When loading hierarchical data load the parent records into the staging table and then run the associated stored procedure to apply them to the entity table where they will be assigned the automatically generated code.加载分层数据时,将父记录加载到暂存表中,然后运行关联的存储过程将它们应用到实体表,在实体表中它们将被分配自动生成的代码。

Next when loading the child records into staging leaf lookup the parent code using a subscription view of the parent entity.接下来,当将子记录加载到暂存叶查找中时,使用父实体的订阅视图查找父代码。

When using automatically generate codes, I recommend you start at 10000 or 100000, as Excel sorts the codes as strings.使用自动生成代码时,我建议您从 10000 或 100000 开始,因为 Excel 将代码排序为字符串。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM