3 Replies Latest reply on Apr 4, 2017 1:46 PM by funknor

    Retreive metadata from a VDB data model

    scheligaburt

      I have a vdb that connects different data sources and created a query joining all this data through a virtual type model.

      Is it possible to retrieve the metadata from this source?

        • 1. Re: Retreive metadata from a VDB data model
          rareddy

          Burt,

           

          Each VDB comes with "SYS" model/schema, there is variety of information you can glean from these tables. Also if you are using JDBC driver, then JDBC metadata layer can also provide lot of this information.


          Ramesh..

          • 2. Re: Retreive metadata from a VDB data model
            scheligaburt

            Thank you Ramesh!

            • 3. Re: Retreive metadata from a VDB data model
              funknor

              here is a query, that I use against any given VDB (see below), it returns a flat list of schema (model), tables and column with types as an example

               

              SELECT

              n.nspname,

              c.relname,

              a.attnum AS ordinal_position,

              a.attname AS column_name,

              t.typname AS data_type,

              a.attlen AS character_maximum_length,

              a.atttypmod AS modifier,

              a.attnotnull AS notnull,

              a.atthasdef AS hasdefault

              FROM pg_class c,

              pg_attribute a,

              pg_type t,

              pg_namespace n

              WHERE a.attnum > 0

              AND a.attrelid = c.oid

              AND a.atttypid = t.oid

              AND c.relnamespace = n.oid

              ORDER BY

              n.nspname,

              c.relname,

              a.attnum

               

              I have tried this against VDB importing other VDB, having oracle data sources and also Excel data sources