Friday, March 9, 2012

Dynamic VDBs Are Back With A Punch!!!

You did not think we removed this feature from Teiid forever did you? In earlier releases of Teiid 8.0 cycles, Dynamic VDBs were not supported due to lack of non-archive file based deployment support from the JBoss AS 7. Now that  JBoss AS 7.1.0-Final has been released they added much needed feature to enable the Dynamic VDBs. With that we are announcing the first release of Teiid that is based on JBoss AS 7.1.0-Final.

Teiid 8.0.Beta1 is released today. Teiid 8.0.Final will also be based upon same version of JBoss AS. This release brings back Dynamic VDB feature, but that is not the big news. Now you can define virtual tables, procedures and functions as you did in Teiid Designer based VDB are now can be defined in the Dynamic VDBs using DDL with out Teiid Designer. Yes, using DDL! This can lead design of Virtual Databases that are more dynamic in nature that can be changed programatically. Without any more non-sense here is quick example.

The below example is extension of the example from Quick Start Guide, so if you are new to Teiid start with that example. Also a full project with all files is also available in the Teiid download archive in the examples section (see docs/teiid/examples/dynamicvdb-portfolio)

dynamic-portfolio-vdb.xml
 <vdb name="DynamicPortfolio" version= "1">  
   <model name="MarketData">  
     <source name="text-connector" translator-name="file" connection-jndi-name="java:/marketdata-file"/>  
   </model>  
   <model visible = "true" type = "VIRTUAL" name = "portfolio">  
      <metadata import-type = "DDL"><![CDATA[  
        CREATE VIEW stock (  
         symbol varchar,  
         price decimal  
         ) AS   
          select stock.* from (call MarketData.getTextFiles('*.txt')) f,   
          TEXTTABLE(f.file COLUMNS symbol string, price bigdecimal HEADER) stock;  
      ]]>  
      </metadata>  
   </model>  
 </vdb>  

Note in the "portfolio" model, we created a VIEW (stock) that is based on the procedure "getTextFiles", which is exposed by a "file" translator. What we effectively have done here is turned some data from CSV file into a table using "TEXTTABLE", and exposed those results as a table. In prior Teiid 7.x releases you could have defined the "TEXTTABLE" construct as shown in view query above after "AS" keyword, however there was no facility to define an abstraction (or logical) view to expose the results of TEXTTABLE. So, when you deploy the above VDB, you can issue queries like

 SELECT * FROM stock WHERE price > 50.00  

using your JDBC connection to the Teiid's Virtual Database. This effectively created an abstraction for your end users, to hide the real details behind your data integration. That is one of basic tenants of data virtualization.

Read related documentation on this feature at https://docs.jboss.org/author/display/TEIID/View+Definitions+in+VDB

Download and try it out and let us know if you see any issues or question in Teiid forums.

Thank you.

Ramesh.. 

No comments:

Post a Comment