<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/Google+Spreadsheet+Translator">Google Spreadsheet Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (11)</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" >h3. Native Queries <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Google spreadsheet source procedures may be created using the teiid_rel:native-query extension - see [Parameterizable Native Queries|Translators#native]. The procedure will invoke the native-query similar to an native procedure call with the benefits that the query is predetermined and that result column types are known, rather than requiring the use of ARRAYTABLE or similar functionality. <span class="diff-added-words"style="background-color: #dfd;"> See the [#Select] format below.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h4. *Native Procedure* <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h4. *Direct Query Procedure* <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{warning} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, override the translator property called &quot;SupportsNativeQueries&quot; to true. Look for [Override Execution Properties|Translators#Override Execution Properties] above. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, [override the execution property|Translators#Override Execution Properties] called _SupportsDirectQueryProcedure_ to true. <br></td></tr>
            <tr><td class="diff-unchanged" >{warning} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Google spreadsheet translator provides a procedure with name *native* that gives ability to execute any ad-hoc native google spreadsheet queries directly against the source without any Teiid parsing or resolving. Since the metadata of this procedure&#39;s execution results are not known to the Teiid and they are returned as object array. User can use [ARRAYTABLE] to construct a build a tabular output for consumption by client applications. Teiid exposes this procedure with a simple query structure as below <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{info:tip=Name of the Direct Procedure} <br>By default the name of the procedure that executes the queries directly is called *native*.  [Override the execution property|Translators#Override Execution Properties] _DirectQueryProcedureName_ to change it to another name. <br>{info} <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The Google spreadsheet translator gives ability to execute any ad-hoc native google spreadsheet queries directly against the source without any Teiid parsing or resolving. Since the metadata of this procedure&#39;s execution results are not known to Teiid, they are returned as an object array. [ARRAYTABLE] can be used construct tabular output for consumption by client applications. Teiid exposes this procedure with a simple query structure as below: <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h5. Select <br>{code:lang=SQL|title=Select Example} <br></td></tr>
            <tr><td class="diff-changed-lines" >SELECT x.* FROM (call <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">pm1.native(&#39;worksheet=People;query=SELECT</span> <span class="diff-added-words"style="background-color: #dfd;">google_source.native(&#39;worksheet=People;query=SELECT</span> A, B, C&#39;)) w, <br></td></tr>
            <tr><td class="diff-unchanged" > ARRAYTABLE(w.tuple COLUMNS &quot;id&quot; string , &quot;type&quot; string, &quot;name&quot; String) AS x <br>{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >the first argument takes semi-colon(\;) separated name value pairs of following properties to execute the <span class="diff-changed-words">procedure<span class="diff-added-chars"style="background-color: #dfd;">:</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>||Property||Description||Required|| <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|limit|number rows to fetch|no| <br>|offset|offset of rows to fetch from limit or beginning|no| <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;"> <br> <br>{info:tip=Name of the Native Procedure} <br>By default the name of the procedure that executes the queries directly is called *native*, however user can set [Override Execution Properties|Translators#Override Execution Properties] property on _NativeQueryProcedureName_ in vdb.xml file to change it to any other procedure name. <br>{info} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="GoogleSpreadsheetTranslator-GoogleSpreadsheetTranslator"></a>Google Spreadsheet Translator</h1>

<p>The <em>google-spreadsheet</em> translator is used to connect to a Google Spreadsheet. To use the Google Spreadsheet Translator you need to configure and deploy the Google JCA connector - see the Admin Guide.</p>

<p>The query approach expects the data in the worksheet to be in a specific format. Namely:</p>
<ul>
        <li>Any column that has data is queryable.</li>
        <li>Any non-string column with an empty cell has the value retrieved as null, otherwise it is the empty string.</li>
        <li>If the first row is present and contains string values, then it will be assumed to represent the column labels.</li>
</ul>


<p>If you are using a dynamic vdb, the metadata for your Google account (worksheets and information about columns in worksheets) are loaded upon translator start up. If you make any changes in data types, it is advisable to restart your vdb.</p>

<p>The translator supports queries against a single sheet. It supports ordering, aggregation, basic predicates, and most of the functions supported by the spreadsheet query language.</p>

<p>There are no google-spreadsheet importer settings, but it does provide metadata for dynamic VDBs.</p>

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

<p>Google spreadsheet source procedures may be created using the teiid_rel:native-query extension - see <a href="/author/display/TEIID/Translators#Translators-native">Parameterizable Native Queries</a>. The procedure will invoke the native-query similar to an native procedure call with the benefits that the query is predetermined and that result column types are known, rather than requiring the use of ARRAYTABLE or similar functionality.  See the <a href="#GoogleSpreadsheetTranslator-Select">Select</a> format below.</p>

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

<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 feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">override the execution property</a> called <em>SupportsDirectQueryProcedure</em> to true.</td></tr></table></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>By default the name of the procedure that executes the queries directly is called <b>native</b>.  <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">Override the execution property</a> <em>DirectQueryProcedureName</em> to change it to another name.</td></tr></table></div>

<p>The Google spreadsheet translator gives ability to execute any ad-hoc native google spreadsheet queries directly against the source without any Teiid parsing or resolving. Since the metadata of this procedure's execution results are not known to Teiid, they are returned as an object array. <a href="/author/display/TEIID/ARRAYTABLE" title="ARRAYTABLE">ARRAYTABLE</a> can be used construct tabular output for consumption by client applications. Teiid exposes this procedure with a simple query structure as below:</p>

<h5><a name="GoogleSpreadsheetTranslator-Select"></a>Select</h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Select Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call google_source.native('worksheet=People;query=SELECT A, B, C')) w,
 ARRAYTABLE(w.tuple COLUMNS "id" string , "type" string, "name" String) AS x
</pre>
</div></div>

<p>the first argument takes semi-colon(;) separated name value pairs of following properties to execute the procedure:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Property</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>worksheet</td>
<td class='confluenceTd'>Google spreadsheet name</td>
<td class='confluenceTd'>yes</td>
</tr>
<tr>
<td class='confluenceTd'>query</td>
<td class='confluenceTd'>spreadsheet query</td>
<td class='confluenceTd'>yes</td>
</tr>
<tr>
<td class='confluenceTd'>limit</td>
<td class='confluenceTd'>number rows to fetch</td>
<td class='confluenceTd'>no</td>
</tr>
<tr>
<td class='confluenceTd'>offset</td>
<td class='confluenceTd'>offset of rows to fetch from limit or beginning</td>
<td class='confluenceTd'>no</td>
</tr>
</tbody></table>
</div>

    </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/Google+Spreadsheet+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477052&revisedVersion=3&originalVersion=2">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Google+Spreadsheet+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>