1 Reply Latest reply on Feb 9, 2017 6:43 PM by Steven Hawkins

    objecttable queries

    virtualdatabase Apprentice

      I have written a query leveraging the objectable function:

       

      SELECT

        x.*

        FROM

        OBJECTTABLE('teiid_context' COLUMNS LastPingTime string 'teiid_row.session.getLastPingTime', ApplicationName string 'teiid_row.session.getApplicationName', SessionID string 'teiid_row.session.getSessionId', UserName string 'teiid_row.session.getUserName', VDBName string 'teiid_row.session.getVDBName', VDBVersion integer 'teiid_row.session.getVDBVersion', ClientIPAddress string 'teiid_row.session.getIPAddress', ClientHostName string 'teiid_row.session.getClientHostName', ClientMACAddress string 'teiid_row.session.getClientHardwareAddress', SessionStartTime string 'teiid_row.session.getCreatedTime', SessionSecurityDomain string 'teiid_row.session.getSecurityDomain') AS x

       

       

      I have two questions...

       

      1) how do I convert the SessionStartTime and getCreatedTIme  to systemdates and times?? They seem to be epochdates but I cant seem to convert them successfully.

       

      2) what other contexts besides teiid_context can I leverage?... also what other items besides teiid_row.session are available and what are those methods.

       

       

       

      Thanks!!

        • 1. Re: objecttable queries
          Steven Hawkins Master

          > 1) how do I convert the SessionStartTime and getCreatedTIme  to systemdates and times?? They seem to be epochdates but I cant seem to convert them successfully.

           

          They are Java long values representing the milliseconds since the epoch.  You can use from_unixtime(val/1000) if you don't mind second resolution.

           

          >  2) what other contexts besides teiid_context can I leverage?... also what other items besides teiid_row.session are available and what are those methods.

           

          See OBJECTTABLE · Teiid Documentation there is no other context accessible.  teiid_row does not provide a fixed number of methods, rather it represents the current item that is being iterated over.  The scripts you use for the column values will depend upon on what teiid_row represents.  There is also a special variable teiid_row_number that can be to number the items from a single iteration.