<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Apache+Accumulo+Translator">Apache Accumulo Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~rareddy">Ramesh Reddy</a>
    </h4>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Accumulo translator is capable of traversing through Accumulo table structures and build a metadata structure for Teiid translator. The schema importer can understand simple tables by traversing a single ROWID of data, then looks for all the unique keys, based on it it comes up with a tabular structure for Accumulo based table. Using the following import properties, you can further refine the import behavior. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4. Import Properties <br></td></tr>
            <tr><td class="diff-unchanged" >||Property Name||Description||Required||Default|| <br>|ColumnNamePattern|How the column name should be formed|false|\{CF\}_\{CQ\}| <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{note} <br></td></tr>
            <tr><td class="diff-changed-lines" >\{CQ\}, \{CF\}, \{ROWID\} are expressions that you can use to define above <span class="diff-changed-words">properties<span class="diff-added-chars"style="background-color: #dfd;"> in any pattern</span>,</span> and respective values of Column Qualifer, Column Familiy or ROWID will be replaced at import time. ROW ID of the Accumulo table, is automatically created as ROWID column, and will be defined as Primary Key on the table. <br></td></tr>
            <tr><td class="diff-unchanged" >{note} <br> <br>You can also define the metadata for the Accumulo based model,  using DDL or using the Teiid Designer. When doing such exercise, the Accumulo Translator currently defines following extended metadata properties to be defined on its Teiid schema model to guide the translator to make proper decisions. <br></td></tr>
            <tr><td class="diff-changed-lines" >The following properties are described under NAMESPACE &quot;http://www.teiid.org/translator/accumulo/2013&quot;, for user convenience this namespace has alias name _teiid_accumulo_ defind in Teiid. To define a extension property use expression like &quot;teiid_accumulo:\{property-name\} value&quot;. All the properties below are intended to be used as OPTION properties on <span class="diff-changed-words">COLUMNS<span class="diff-added-chars"style="background-color: #dfd;">. See [DDL Metadata] for more information on defining DDL based metadata.</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4. Extension Metadata Properties <br> <br></td></tr>
            <tr><td class="diff-unchanged" >||Property Name||Description||Required||Default|| <br>|CF|Column Family|true|none| <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|VALUE-IN|Value of column defined in. Possible values (VALUE, CQ)|false|VALUE| <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3. How to use above Properties <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Say for example you have a table called &quot;User&quot; in your Accumulo instance, and doing a scan returned following data <br>{code} <br>root@teiid&gt; table User <br>root@teiid User&gt; scan <br>  1 name:age []    43 <br>  1 name:firstname []   John <br>  1 name:lastname []    Does <br>  2 name:age []    10 <br>  2 name:firstname []   Jane <br>  2 name:lastname []    Smith <br>  3 name:age []    13 <br>  3 name:firstname []   Mike <br>  3 name:lastname []    Davis <br>{code} <br> <br>If you used the default importer from the Accumulo translator(like Dynamic VDB defined above), the table generated will be like below <br> <br>{code} <br>CREATE FOREIGN TABLE &quot;User&quot; ( <br>        rowid string OPTIONS (UPDATABLE FALSE, SEARCHABLE &#39;All_Except_Like&#39;), <br>        name_age string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;age&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        name_firstname string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;firstname&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        name_lastname string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;lastname&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        CONSTRAINT PK0 PRIMARY KEY(rowid) <br>) OPTIONS (UPDATABLE TRUE); <br>{code} <br> <br>You can use &quot;Import Property&quot; as &quot;ColumnNamePattern&quot; as &quot;\{CQ\}&quot; will generate the following (note the names of the column) <br> <br>{code} <br>CREATE FOREIGN TABLE &quot;User&quot; ( <br>        rowid string OPTIONS (UPDATABLE FALSE, SEARCHABLE &#39;All_Except_Like&#39;), <br>        age string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;age&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        firstname string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;firstname&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        lastname string OPTIONS (SEARCHABLE &#39;All_Except_Like&#39;, &quot;teiid_accumulo:CF&quot; &#39;name&#39;, &quot;teiid_accumulo:CQ&quot; &#39;lastname&#39;, &quot;teiid_accumulo:VALUE-IN&quot; &#39;{VALUE}&#39;), <br>        CONSTRAINT PK0 PRIMARY KEY(rowid) <br>) OPTIONS (UPDATABLE TRUE); <br>{code} <br> <br>respectively if the column name is defined by Column Family, you can use &quot;ColumnNamePattern&quot; as &quot;\{CF\}&quot;, and if the value for that column exists in the Column Qualifier then you can use &quot;ValueIn&quot; as &quot;\{CQ\}&quot;. Using import properties you can dictate how the table should be modeled. <br> <br>If you did not use built in import (not using Teiid Designer&#39;s Teiid Connection &gt;&gt; Source Model or Dynamic VDB), and would like to manually design the table in Designer like below <br> <br>!user.png|border=1! <br> <br>Then you must make sure you supply the Extension Metadata Properties defined above on the User table&#39;s columns from Accumulo extended metadata(In Designer, right click on Model, and select &quot;Model Extension Definitions&quot; and select Accumulo. For example on FirstName column, you would supply <br> <br>{code} <br>teiid_accumulo:CF  name <br>teiid_accumulo:CQ  firstname <br>teiid_accumulo:VALUE-IN  VALUE <br>{code} <br> <br>and repeat for each and every column, so that Teiid knows how to communicate correctly with Accumulo. <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. *JCA Resource Adapter* <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="ApacheAccumuloTranslator-ApacheAccumuloTranslator"></a><b>Apache Accumulo Translator</b></h1>

<p>The Apache Accumulo Translator, known by the type name <em>accumulo</em>, exposes querying functionality to <a href="/author/display/TEIID/Accumulo+Data+Sources" title="Accumulo Data Sources">Accumulo Data Sources</a>.  <a href="https://accumulo.apache.org/" class="external-link" rel="nofollow">Apache Accumulo</a> is a sorted, distributed key value store with robust, scalable, high performance data storage and retrieval system. This translator provides an easy way connect to Accumulo system and provides relational way using SQL to add records from directly from user or from other sources that are integrated with Teiid. It also gives ability to read/update/delete existing records from Accumulo store. Teiid has capability to pass-in logged in user's roles as visibility properties to restrict the data access.</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>This document assumes that user is familiar with Accumulo source and has basic understanding of how Teiid works. This document only contains details about Accumulo translator.</td></tr></table></div>

<h3><a name="ApacheAccumuloTranslator-IntendedUsecases"></a><b>Intended Usecases</b></h3>

<p>The usage Accumulo translator can be highly dependent on user's usecase(s). Here are some common scenarios.</p>

<ul>
        <li>Accumulo source can be used in Teiid, to continually add/update the documents in the Accumulo system from other sources automatically.</li>
        <li>Access Accumulo through SQL interface.</li>
        <li>Make use of cell level security through enterprise roles.</li>
        <li>Accumulo translator can be used as an indexing system to gather data from other enterprise sources such as RDBMS, Web Service, SalesForce etc, all in single client call transparently with out any coding.</li>
</ul>


<h3><a name="ApacheAccumuloTranslator-Usage"></a>Usage</h3>

<p>Apache Accumulo is distributed key value store with unique data model. It allows to group its key-value pairs in a collection called "table". The key structure is defined as</p>

<p><span class="image-wrap" style=""><img src="/author/download/attachments/78708861/accumulo.png?version=1&amp;modificationDate=1392766277000" style="border: 1px solid black" /></span></p>

<p>Based on above information, one can define a schema representing Accumulo table structures in Teiid using DDL or using Teiid Designer with help of metadata extension properties defined below. Since no data type information is defined on the columns, by default all columns are considered as string data types. However, during modeling of the schema, one can use various other data types supported through Teiid to define a data type of column, that user wishes to expose as.</p>

<p>Once this schema is defined and exposed through VDB in a Teiid database, and <a href="/author/display/TEIID/Accumulo+Data+Sources" title="Accumulo Data Sources">Accumulo Data Sources</a> is created, the user can issue  "INSERT/UPDATE/DELETE" based SQL calls to insert/update/delete records into the Accumulo, and issue "SELECT" based calls to retrieve records from Accumulo. You can use full range of SQL with Teiid system integrating other sources along with Accumulo source.</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>By default, Accumulo table structure is flat can not define relationships among tables. So, a SQL JOIN is performed in Teiid layer rather than pushed to source even if both tables on either side of the JOIN reside in the Accumulo. Currently any criteria based on EQUALITY and/or COMPARISON using complex AND/OR clauses are handled by Accumulo translator and will be properly executed at source.</td></tr></table></div>

<p>An Example Dynamic VDB that shows Accumulo translator can be defined as </p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>"accumulo-vdb.xml"</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
&lt;vdb name="myvdb" version="1"&gt;
    &lt;model name="accumulo"&gt;
        &lt;source name="node-one" translator-name="accumulo" connection-jndi-name="java:/accumuloDS"/&gt;
    &lt;/model&gt;
&lt;vdb&gt;
</pre>
</div></div>

<p>The translator does NOT provide a connection to the Accumulo. For that purpose, Teiid has a JCA adapter that provides a connection to Accumulo using Accumulo Java libraries. To define such connector, see <a href="/author/display/TEIID/Accumulo+Data+Sources" title="Accumulo Data Sources">Accumulo Data Sources</a> or see an example in "&lt;jboss-as&gt;/docs/teiid/datasources/accumulo"</p>

<p>If you are using Designer Tooling, to create VDB</p>
<ul>
        <li>Create/use a Teiid Designer Model project</li>
        <li>Use "Teiid Connection &gt;&gt; Source Model" importer, create Accumulo Data Source using data source creation wizard and use <em>accumulo</em> as translator in the importer. The table is created in a source model by the time you finish with this importer.</li>
        <li>Create a VDB and deploy into Teiid Server and use either jdbc, odbc, odata etc to query.</li>
</ul>


<h3><a name="ApacheAccumuloTranslator-Properties"></a><b>Properties</b></h3>

<p>Accumulo translator is capable of traversing through Accumulo table structures and build a metadata structure for Teiid translator. The schema importer can understand simple tables by traversing a single ROWID of data, then looks for all the unique keys, based on it it comes up with a tabular structure for Accumulo based table. Using the following import properties, you can further refine the import behavior.</p>

<h4><a name="ApacheAccumuloTranslator-ImportProperties"></a>Import Properties</h4>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Property Name</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
<th class='confluenceTh'>Default</th>
</tr>
<tr>
<td class='confluenceTd'>ColumnNamePattern</td>
<td class='confluenceTd'>How the column name should be formed</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>{CF}_{CQ}</td>
</tr>
<tr>
<td class='confluenceTd'>ValueIn</td>
<td class='confluenceTd'>Where the value for column is defined CQ or VALUE</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>{VALUE}</td>
</tr>
</tbody></table>
</div>



<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>{CQ}, {CF}, {ROWID} are expressions that you can use to define above properties in any pattern, and respective values of Column Qualifer, Column Familiy or ROWID will be replaced at import time. ROW ID of the Accumulo table, is automatically created as ROWID column, and will be defined as Primary Key on the table.</td></tr></table></div>

<p>You can also define the metadata for the Accumulo based model,  using DDL or using the Teiid Designer. When doing such exercise, the Accumulo Translator currently defines following extended metadata properties to be defined on its Teiid schema model to guide the translator to make proper decisions.<br/>
The following properties are described under NAMESPACE "http://www.teiid.org/translator/accumulo/2013", for user convenience this namespace has alias name <em>teiid_accumulo</em> defind in Teiid. To define a extension property use expression like "teiid_accumulo:{property-name} value". All the properties below are intended to be used as OPTION properties on COLUMNS. See <a href="/author/display/TEIID/DDL+Metadata" title="DDL Metadata">DDL Metadata</a> for more information on defining DDL based metadata. </p>

<h4><a name="ApacheAccumuloTranslator-ExtensionMetadataProperties"></a>Extension Metadata Properties</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Property Name</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
<th class='confluenceTh'>Default</th>
</tr>
<tr>
<td class='confluenceTd'>CF</td>
<td class='confluenceTd'>Column Family</td>
<td class='confluenceTd'>true</td>
<td class='confluenceTd'>none</td>
</tr>
<tr>
<td class='confluenceTd'>CQ</td>
<td class='confluenceTd'>Column Qualifier</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>empty</td>
</tr>
<tr>
<td class='confluenceTd'>VALUE-IN</td>
<td class='confluenceTd'>Value of column defined in. Possible values (VALUE, CQ)</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>VALUE</td>
</tr>
</tbody></table>
</div>


<h3><a name="ApacheAccumuloTranslator-HowtouseaboveProperties"></a>How to use above Properties</h3>

<p>Say for example you have a table called "User" in your Accumulo instance, and doing a scan returned following data</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
root@teiid&gt; table User
root@teiid User&gt; scan
  1 name:age []    43
  1 name:firstname []   John
  1 name:lastname []    Does
  2 name:age []    10
  2 name:firstname []   Jane
  2 name:lastname []    Smith
  3 name:age []    13
  3 name:firstname []   Mike
  3 name:lastname []    Davis
</pre>
</div></div>

<p>If you used the default importer from the Accumulo translator(like Dynamic VDB defined above), the table generated will be like below</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN TABLE "User" (
        rowid string OPTIONS (UPDATABLE FALSE, SEARCHABLE 'All_Except_Like'),
        name_age string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'age', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        name_firstname string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'firstname', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        name_lastname string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'lastname', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        CONSTRAINT PK0 PRIMARY KEY(rowid)
) OPTIONS (UPDATABLE TRUE);
</pre>
</div></div>

<p>You can use "Import Property" as "ColumnNamePattern" as "{CQ}" will generate the following (note the names of the column)</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN TABLE "User" (
        rowid string OPTIONS (UPDATABLE FALSE, SEARCHABLE 'All_Except_Like'),
        age string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'age', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        firstname string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'firstname', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        lastname string OPTIONS (SEARCHABLE 'All_Except_Like', "teiid_accumulo:CF" 'name', "teiid_accumulo:CQ" 'lastname', "teiid_accumulo:VALUE-IN" '{VALUE}'),
        CONSTRAINT PK0 PRIMARY KEY(rowid)
) OPTIONS (UPDATABLE TRUE);
</pre>
</div></div>

<p>respectively if the column name is defined by Column Family, you can use "ColumnNamePattern" as "{CF}", and if the value for that column exists in the Column Qualifier then you can use "ValueIn" as "{CQ}". Using import properties you can dictate how the table should be modeled.</p>

<p>If you did not use built in import (not using Teiid Designer's Teiid Connection &gt;&gt; Source Model or Dynamic VDB), and would like to manually design the table in Designer like below</p>

<p><span class="image-wrap" style=""><img src="/author/download/attachments/78708861/user.png?version=1&amp;modificationDate=1392839923924" style="border: 1px solid black" /></span></p>

<p>Then you must make sure you supply the Extension Metadata Properties defined above on the User table's columns from Accumulo extended metadata(In Designer, right click on Model, and select "Model Extension Definitions" and select Accumulo. For example on FirstName column, you would supply</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
teiid_accumulo:CF  name
teiid_accumulo:CQ  firstname
teiid_accumulo:VALUE-IN  VALUE
</pre>
</div></div>

<p>and repeat for each and every column, so that Teiid knows how to communicate correctly with Accumulo.</p>


<h3><a name="ApacheAccumuloTranslator-JCAResourceAdapter"></a><b>JCA Resource Adapter</b></h3>

<p>The Teiid specific Accumulo Resource Adapter should be used with this translator.  See <a href="/author/display/TEIID/Accumulo+Data+Sources" title="Accumulo Data Sources">Accumulo Data Sources</a> for connecting to a Accumulo Source.</p>

<h3><a name="ApacheAccumuloTranslator-NativeQueries"></a>Native Queries</h3>

<p>Currently this feature is not applicable. Based on user demand Teiid could expose a way for user to submit a MAP-REDUCE job.</p>


<h4><a name="ApacheAccumuloTranslator-DirectQueryProcedure"></a><b>Direct Query Procedure</b></h4>

<p>This feature is not applicable for this translator.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Apache+Accumulo+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=78708861&revisedVersion=2&originalVersion=1">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Apache+Accumulo+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>