Generating a unique ID in a DV View

Solution Verified - Updated -

Issue

  • Since OData queries require a Primary Key on a view, is there a function or some other means to generate a unique value that can be used as a key?

Environment

  • Red Hat JBoss Data Virtualization (DV) 6.1
  • Dynamic VDB creating a view for OData queries:
<vdb name="Attestation" version="1">

    <import-vdb name="MyLINC" version="1" import-data-policies="true"/>
    <import-vdb name="MLearning" version="1" import-data-policies="true"/>
    <import-vdb name="eResearch" version="1" import-data-policies="true"/>

    <model visible="true" type="VIRTUAL" name="Attestation">
        <metadata type = "DDL"><![CDATA[
            CREATE VIEW training (
                uniqname     STRING,
                provider     STRING,
                module_code  STRING,
                module_name  STRING,
                expire_dt    TIMESTAMP,
                status       STRING
            ) OPTIONS (updatable false, materialized true)
            AS SELECT
                    pt.uniqname,
                    pt.provider,
                    pt.module_code,
                    pt.module_name,
                    pt.expire_dt,
                    CASE WHEN pt.expire_dt >= NOW()
                        THEN 'Y'
                        ELSE 'N'
                    END status
               FROM mylinc.peerrs_training pt
               UNION
               SELECT
                   ml.uniqname,
                   ml.provider,
                   ml.activity_code,
                   ml.activity_name,
                   TIMESTAMPADD(SQL_TSI_DAY, 1095, ml.acquired_date),
                   CASE WHEN TIMESTAMPDIFF(SQL_TSI_DAY, ml.acquired_date, NOW()) <= 1095
                       THEN 'Y'
                       ELSE 'N'
                   END
               FROM mlearning.transcript ml
        ]]>
        </metadata>
    </model>
</vdb>

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.