简体   繁体   English

ODI 12c 变量

[英]ODI 12c Variables

I am facing difficulties in the doing the following task:我在执行以下任务时遇到困难:

Create a table in db, which contains the file name.在 db 中创建一个表,其中包含文件名。 Read the file name from this table using variable in ODI.使用 ODI 中的变量从该表中读取文件名。 Read from this file and then map the content into a table Use this by creating a package.从此文件中读取内容,然后 map 将内容放入表中,通过创建 package 使用它。

Please help me with this.请帮我解决一下这个。

Thank You谢谢你

I have created a table in database which contains the file name.我在数据库中创建了一个包含文件名的表。

I am assuming you are just struggling with the dynamic loading and are happy with creating the mappings etc. If not you need to work out the basics first and go through the ODI documentation and examples that are out there.我假设您只是在努力处理动态加载并且对创建映射等感到满意。如果没有,您需要先了解基础知识,然后通过 ODI 文档和示例了解 go。 Unless you understand how to build mappings, set variables and how packages work you are not going to be able to jump in the at the deep end and achieve this.除非您了解如何构建映射、设置变量以及包的工作方式,否则您将无法深入了解并实现这一目标。

Overview概述

A variable is only going to be able to store one value at a time so I presuming your table will only contain a single value.一个变量一次只能存储一个值,所以我假设您的表将只包含一个值。 If it can contain multiple files it gets more complicated as you will need to be able to pick out one value at aa time.如果它可以包含多个文件,它会变得更加复杂,因为您需要能够一次选择一个值。

You will need to create a variable and set the refresh query to be something like您将需要创建一个变量并将刷新查询设置为类似

SELECT file_name FROM DB_TABLE WHERE rownum - 1

That variable can then be used in the resource name of the file in the ODI model.然后可以在 ODI model 中的文件的资源名称中使用该变量。

You can then add that variable into an ODI package as a refresh step.然后,您可以将该变量作为刷新步骤添加到 ODI package 中。 Add you mapping into the same package and when run it will query the database to get the value and then use that as the filename when running the mapping.将您的映射添加到同一个 package 中,运行时它将查询数据库以获取值,然后在运行映射时将其用作文件名。

Extras附加功能

The issue you are likely to have is that you need define the file structure in the ODI model. If this is a fixed format then you are OK as you can just create all the fields and metadata as needed.您可能遇到的问题是您需要在 ODI model 中定义文件结构。如果这是一个固定格式,那么您就可以了,因为您可以根据需要创建所有字段和元数据。 If the structure if fluid then this really doesn't fit easily into ODI and is really difficult to achieve.如果结构是流动的,那么这真的不容易融入 ODI,而且真的很难实现。

If your aim is actually to have a dynamic filename and you are using load plans then you don't need a package at all (indeed it just adds more complexity) you can simply set the resource name to the variable, add the variable to your load plan and ensure it is refreshed before the mapping runs and the result would be the same as above如果你的目标实际上是拥有一个动态文件名并且你正在使用加载计划那么你根本不需要 package (实际上它只会增加更多的复杂性)你可以简单地将资源名称设置为变量,将变量添加到你的加载计划并确保在映射运行之前刷新它,结果与上面相同

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

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