<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Flex data functions</title>
    <link>/en/sql-reference/functions/flex-functions/flex-data-functions/</link>
    <description>Recent content in Flex data functions on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/functions/flex-functions/flex-data-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: BUILD_FLEXTABLE_VIEW</title>
      <link>/en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/</guid>
      <description>
        
        
        &lt;p&gt;Creates, or re-creates, a view for a default or user-defined keys table, ignoring any empty keys.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

If the length of a key exceeds 65,000, OpenText™ Analytics Database truncates the key.

&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This is a meta-function. You must call meta-functions in a top-level &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement.&lt;/p&gt;

&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;Volatile&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BUILD_FLEXTABLE_VIEW (&amp;#39;[[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;flex-table&lt;/span&gt;&amp;#39;
    [ [,&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;view-name&lt;/span&gt;&amp;#39;] [,&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;user-keys-table&lt;/span&gt;&amp;#39;] ])
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The flex table name. By default, this function builds or rebuilds a view for the input table with the current contents of the associated &lt;code&gt;flex_table_keys&lt;/code&gt; table.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;view-name&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;A custom view name. Use this option to build a new view for &lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt; with the name you specify.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;user-keys-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of a keys table from which to create the view. Use this option if you created a custom keys table from the flex table map data, rather than from the default &lt;code&gt;flex_table_keys&lt;/code&gt; table. The function builds a view from the keys in &lt;code&gt;user_keys&lt;/code&gt;, rather than from &lt;code&gt;flex_table_keys&lt;/code&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following examples show how to call &lt;span class=&#34;sql&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/span&gt; with 1, 2, or 3 arguments.&lt;/p&gt;
&lt;p&gt;To create, or re-create, a default view:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Call the function with an input flex table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT BUILD_FLEXTABLE_VIEW(&amp;#39;darkdata&amp;#39;);
                  build_flextable_view
-----------------------------------------------------
 The view public.darkdata_view is ready for querying
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The function creates a view with the default name (&lt;code&gt;darkdata_view&lt;/code&gt;) from the &lt;span class=&#34;sql&#34;&gt;&lt;code&gt;darkdata&lt;/code&gt;_keys&lt;/span&gt; table.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Query a key name from the new or updated view:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#34;user.id&amp;#34; FROM darkdata_view;
  user.id
-----------
 340857907
 727774963
 390498773
 288187825
 164464905
 125434448
 601328899
 352494946
(12 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To create, or re-create, a view with a custom name:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Call the function with two arguments, an input flex table, &lt;code&gt;darkdata&lt;/code&gt;, and the name of the view to create, &lt;code&gt;dd_view&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT BUILD_FLEXTABLE_VIEW(&amp;#39;darkdata&amp;#39;, &amp;#39;dd_view&amp;#39;);
            build_flextable_view
-----------------------------------------------
 The view public.dd_view is ready for querying
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Query a key name (&lt;code&gt;user.lang&lt;/code&gt;) from the new or updated view (&lt;code&gt;dd_view&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#34;user.lang&amp;#34; FROM dd_view;
 user.lang
-----------
 tr
 en
 es
 en
 en
 it
 es
 en
(12 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To create a view from a custom keys table with &lt;span class=&#34;sql&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/span&gt;, the custom table must have the same schema and table definition as the default table (&lt;code&gt;darkdata_keys&lt;/code&gt;). Create a custom keys table, using any of these three approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Create a columnar table with all keys from the default keys table for a flex table (&lt;code&gt;darkdata_keys&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE new_darkdata_keys AS SELECT * FROMdarkdata_keys;
CREATE TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a columnar table without content (&lt;code&gt;LIMIT 0&lt;/code&gt;) from the default keys table for a flex table (&lt;code&gt;darkdata_keys&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE new_darkdata_keys AS SELECT * FROM darkdata_keys LIMIT 0;
CREATE TABLE
kdb=&amp;gt; SELECT * FROM new_darkdata_keys;
 key_name | frequency | data_type_guess
----------+-----------+-----------------
(0 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a columnar table without content (&lt;code&gt;LIMIT 0&lt;/code&gt;) from the default keys table, and insert two values (&#39;&lt;code&gt;user.lang&lt;/code&gt;&#39;, &#39;&lt;code&gt;user.name&lt;/code&gt;&#39;) into the &lt;code&gt;key_name&lt;/code&gt; column:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE dd_keys AS SELECT * FROM darkdata_keys limit 0;
CREATE TABLE
=&amp;gt; INSERT INTO dd_keys (key_name) values (&amp;#39;user.lang&amp;#39;);
 OUTPUT
--------
      1
(1 row)
=&amp;gt; INSERT INTO dd_keys (key_name) values (&amp;#39;user.name&amp;#39;);
 OUTPUT
--------
      1
(1 row)
=&amp;gt; SELECT * FROM dd_keys;
 key_name  | frequency | data_type_guess
-----------+-----------+-----------------
 user.lang |           |
 user.name |           |
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After creating a custom keys table, call &lt;span class=&#34;sql&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/span&gt; with all arguments (an input flex table, the new view name, the custom keys table):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT BUILD_FLEXTABLE_VIEW(&amp;#39;darkdata&amp;#39;, &amp;#39;dd_view&amp;#39;, &amp;#39;dd_keys&amp;#39;);
            build_flextable_view
-----------------------------------------------
 The view public.dd_view is ready for querying
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Query the new view:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM dd_view;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/#&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/#&#34;&gt;RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: COMPUTE_FLEXTABLE_KEYS</title>
      <link>/en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/</guid>
      <description>
        
        
        &lt;p&gt;Computes the virtual columns (keys and values) from flex table VMap data. Use this function to compute keys without creating an associated table view. To also build a view, use &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is a meta-function. You must call meta-functions in a top-level &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement.&lt;/p&gt;

&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;Volatile&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COMPUTE_FLEXTABLE_KEYS (&amp;#39;[[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;flex-table&lt;/span&gt;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the flex table.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;output&#34;&gt;Output&lt;/h2&gt;
&lt;p&gt;The function stores its results in a table named &lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;code&gt;_keys&lt;/code&gt;. The table has the following columns:&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Column&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
KEY_NAME&lt;/td&gt; 

&lt;td &gt;
The name of the virtual column (key). Keys larger than 65,000 bytes are truncated.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
FREQUENCY&lt;/td&gt; 

&lt;td &gt;
The number of times the key occurs in the VMap.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
DATA_TYPE_GUESS&lt;/td&gt; 

&lt;td &gt;
Estimate of the data type for the key based on the non-null values found in the VMap. The function determines the type of each non-string value, depending on the length of the key, and whether the key includes nested maps. If the &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/general-parameters/#EnableBetterFlexTypeGuessing&#34;&gt;EnableBetterFlexTypeGuessing&lt;/a&gt; configuration parameter is 0 (OFF), this function instead treats all flex table keys as string types ([LONG] VARCHAR or [LONG] VARBINARY).&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;COMPUTE_FLEXTABLE_KEYS sets the column width for keys to the length of the largest value for each key multiplied by the &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/general-parameters/#FlexTableDataTypeGuessMultiplier&#34;&gt;FlexTableDataTypeGuessMultiplier&lt;/a&gt; factor.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;In the following example, JSON data with consistent fields has been loaded into a flex table. Had the data been more varied, you would see different numbers of occurrences in the keys table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT COMPUTE_FLEXTABLE_KEYS(&amp;#39;reviews_flex&amp;#39;);
             COMPUTE_FLEXTABLE_KEYS
-------------------------------------------------
 Please see public.reviews_flex_keys for updated keys
(1 row)

SELECT * FROM reviews_flex_keys;
  key_name   | frequency | data_type_guess
-------------+-----------+-----------------
 user_id     |      1000 | Varchar(44)
 useful      |      1000 | Integer
 text        |      1000 | Varchar(9878)
 stars       |      1000 | Numeric(5,2)
 review_id   |      1000 | Varchar(44)
 funny       |      1000 | Integer
 date        |      1000 | Timestamp
 cool        |      1000 | Integer
 business_id |      1000 | Varchar(44)
(9 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/#&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/#&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/#&#34;&gt;RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW</title>
      <link>/en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/</guid>
      <description>
        
        
        &lt;p&gt;Combines the functionality of &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/#&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt; to compute virtual columns (keys) from the VMap data of a flex table and construct a view. Creating a view with this function ignores empty keys. If you do not need to perform both operations together, use one of the single-operation functions instead. &lt;br /&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

If the length of a key exceeds 65,000, OpenText™ Analytics Database truncates the key.

&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This is a meta-function. You must call meta-functions in a top-level &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement.&lt;/p&gt;

&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;Volatile&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW (&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;flex-table&lt;/span&gt;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of a flex table&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This example shows how to call the function for the darkdata flex table.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW(&amp;#39;darkdata&amp;#39;);
               compute_flextable_keys_and_build_view
-----------------------------------------------------------------------
 Please see public.darkdata_keys for updated keys
The view public.darkdata_view is ready for querying
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/#&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/#&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/#&#34;&gt;RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: MATERIALIZE_FLEXTABLE_COLUMNS</title>
      <link>/en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/</guid>
      <description>
        
        
        &lt;p&gt;Materializes virtual columns listed as &lt;em&gt;&lt;code&gt;key_names&lt;/code&gt;&lt;/em&gt; in the &lt;em&gt;&lt;code&gt;flextable_keys&lt;/code&gt;&lt;/em&gt; table you compute using either &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt; or &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Each column that you materialize with this function counts against the data storage limit of your license. To check your OpenText™ Analytics Database license compliance, call the &lt;code&gt;AUDIT()&lt;/code&gt; or &lt;code&gt;AUDIT_FLEX()&lt;/code&gt; functions.

&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This is a meta-function. You must call meta-functions in a top-level &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement.&lt;/p&gt;

&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;Volatile&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;MATERIALIZE_FLEXTABLE_COLUMNS (&amp;#39;[[&lt;span class=&#34;code-variable&#34;&gt;database&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;schema&lt;/span&gt;.]&lt;span class=&#34;code-variable&#34;&gt;flex-table&lt;/span&gt;&amp;#39; [, &lt;span class=&#34;code-variable&#34;&gt;n-columns&lt;/span&gt; [, &lt;span class=&#34;code-variable&#34;&gt;keys-table-name&lt;/span&gt;] ])
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;[&lt;/code&gt;&lt;em&gt;&lt;code&gt;database&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.]&lt;/code&gt;&lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Database and &lt;a href=&#34;../../../../../en/admin/configuring-db/designing-logical-schema/using-multiple-schemas/setting-search-paths/&#34;&gt;schema&lt;/a&gt;. The default schema is &lt;code&gt;public&lt;/code&gt;. If you specify a database, it must be the current database.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The name of the flex table with columns to materialize. The function:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Skips any columns already materialized&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ignores any empty keys&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;n-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The number of columns to materialize, up to 9800. The function attempts to materialize the number of columns from the keys table, skipping any columns already materialized. It orders the materialized results by frequency, descending. If not specified, the default is a maximum of 50 columns.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;keys-table-name&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The name of a keys from which to materialize columns. The function:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Materializes &lt;em&gt;&lt;code&gt;n-columns&lt;/code&gt;&lt;/em&gt; columns from the keys table&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Skips any columns already materialized&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Orders the materialized results by frequency, descending&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example shows how to call &lt;span class=&#34;sql&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/span&gt; to materialize columns. First, load a sample file of tweets (&lt;code&gt;tweets_10000.json&lt;/code&gt;) into the flex table &lt;code&gt;twitter_r&lt;/code&gt;. After loading data and computing keys for the sample flex table, call &lt;span class=&#34;sql&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/span&gt; to materialize the first four columns:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; COPY twitter_r FROM &amp;#39;/home/release/KData/tweets_10000.json&amp;#39; parser fjsonparser();
 Rows Loaded
-------------
       10000
(1 row)

=&amp;gt; SELECT compute_flextable_keys (&amp;#39;twitter_r&amp;#39;);
              compute_flextable_keys
---------------------------------------------------
 Please see public.twitter_r_keys for updated keys
(1 row)

=&amp;gt; SELECT MATERIALIZE_FLEXTABLE_COLUMNS(&amp;#39;twitter_r&amp;#39;, 4);
    MATERIALIZE_FLEXTABLE_COLUMNS
-------------------------------------------------------------------------------
 The following columns were added to the table public.twitter_r:
        contributors
        entities.hashtags
        entities.urls
For more details, run the following query:
SELECT * FROM v_catalog.materialize_flextable_columns_results WHERE table_schema = &amp;#39;public&amp;#39; and table_name = &amp;#39;twitter_r&amp;#39;;

(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The last message in the example recommends querying the &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-catalog-schema/materialize-flextable-columns-results/#&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS_RESULTS&lt;/a&gt; system table for the results of materializing the columns, as shown:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM v_catalog.materialize_flextable_columns_results WHERE table_schema = &amp;#39;public&amp;#39; and table_name = &amp;#39;twitter_r&amp;#39;;
table_id           | table_schema | table_name |      creation_time           |     key_name      | status |    message
-------------------+--------------+------------+------------------------------+-------------------+--------+---------------------
 45035996273733172 | public       | twitter_r  | 2013-11-20 17:00:27.945484-05| contributors      | ADDED  | Added successfully
 45035996273733172 | public       | twitter_r  | 2013-11-20 17:00:27.94551-05 | entities.hashtags | ADDED  | Added successfully
 45035996273733172 | public       | twitter_r  | 2013-11-20 17:00:27.945519-05| entities.urls     | ADDED  | Added successfully
 45035996273733172 | public       | twitter_r  | 2013-11-20 17:00:27.945532-05| created_at        | EXISTS | Column of same name already
(4 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/#&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/#&#34;&gt;RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW</title>
      <link>/en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/flex-functions/flex-data-functions/restore-flextable-default-keys-table-and-view/</guid>
      <description>
        
        
        &lt;p&gt;Restores the keys table and the view. The function also links the keys table with its associated flex table, in cases where either table is dropped. The function also indicates whether it restored one or both objects.&lt;/p&gt;
&lt;p&gt;This is a meta-function. You must call meta-functions in a top-level &lt;a href=&#34;../../../../../en/sql-reference/statements/select/#&#34;&gt;SELECT&lt;/a&gt; statement.&lt;/p&gt;

&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/volatile-functions/&#34; title=&#34;&#34;&gt;Volatile&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW (&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;flex-table&lt;/span&gt;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;flex-table&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of a flex table&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This example shows how to invoke this function with an existing flex table, restoring both the keys table and view:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW(&amp;#39;darkdata&amp;#39;);
                     RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW
----------------------------------------------------------------------------------
The keys table public.darkdata_keys was restored successfully.
The view public.darkdata_view was restored successfully.
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example illustrates that the function restored &lt;code&gt;darkdata_view&lt;/code&gt;, but that &lt;code&gt;darkdata_keys&lt;/code&gt; did not need restoring:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW(&amp;#39;darkdata&amp;#39;);
                    RESTORE_FLEXTABLE_DEFAULT_KEYS_TABLE_AND_VIEW
------------------------------------------------------------------------------------
 The keys table public.darkdata_keys already exists and is linked to darkdata.
 The view public.darkdata_view was restored successfully.
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After restoring the keys table, there is no content. To populate the flex keys, call the &lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt; function.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM darkdata_keys;
 key_name | frequency | data_type_guess
----------+-----------+-----------------
(0 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/build-flextable-view/#&#34;&gt;BUILD_FLEXTABLE_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/compute-flextable-keys-and-build-view/#&#34;&gt;COMPUTE_FLEXTABLE_KEYS_AND_BUILD_VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/flex-functions/flex-data-functions/materialize-flextable-columns/#&#34;&gt;MATERIALIZE_FLEXTABLE_COLUMNS&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
