Teiid Springboot启动文件数据源



使用Teiid Springboot,我想使用磁盘中的xml文件。我曾经使用过旧的EAP/Wildfly Teiid项目,解决这个问题的方法是使用资源适配器,然后调用一个过程来读取数据。

使用Springboot,我需要采取哪些步骤来创建可以在DDL VDB中使用的数据源/资源适配器。我已经看过下面的FTP示例,所以我的假设是创建一个FileConnectionFactory:https://github.com/teiid/teiid-spring-boot/tree/master/samples/ftp然而,这里不使用DDL文件,我更喜欢解析DDL中的XML(除非有更好的方法在我的DDL中公开这些数据(。

使用基于DDL的VDB时,可以通过在application.properties中提供以下属性来定义基于文件的连接

spring.teiid.file.foo.parent-directory=path/to/myfile

其中foo是您的文件资源名称,它需要在VDB中使用,例如:(accounts是为模式指定的名称(

CREATE SERVER foo FOREIGN DATA WRAPPER file;
CREATE SCHEMA accounts SERVER foo;

然后在视图转换中,您可以使用上面的模式并将文件读取为

create view something(...) AS
select x.* from 
(exec accounts.getTextFiles()) f, 
xmltable('/a' PASSING xmlparse(document f.file) COLUMNS first string, second integer) x

有关使用xmltable的更多详细信息,请参阅http://teiid.github.io/teiid-documents/master/content/reference/r_xmltable.html

最新更新