4 Replies Latest reply on Sep 23, 2013 2:21 PM by devin pinkston

    Gathering Metadata

    devin pinkston Newbie

      Hello,

       

      Is it possible through the adminAPI to gather the metadata for each Virtual Database?  I see the classes under adminiapi.impl such as VDBMetadataParser and VDBMetadata, but through this API can we gather the metadata (Column Structure/types) for say a JDBC source such as MySQL that only has a source model defined in the VDB and no view or DDL metadata?  I am trying to think of the best route to aggregate all the metadata for any VDB deployed and store it another data source.

       

      Thank you!

        • 1. Re: Gathering Metadata
          Ramesh Reddy Master

          Look at the "getSchema" method on Admin API, you can get DDL form of your metadata of a model.

          • 2. Re: Gathering Metadata
            devin pinkston Newbie

            Ramesh,

             

            Is there a better way to simply grab the table name from the metadata than walking the SQL String manually?  For instance if I return a string of DDL from the "getSchema" method, right now I am using this code:

             

            Schema s = helpParse (this.ddl, this.modelName).getSchema();

                    Map<String, Table> tableMap = s.getTables();

                    System.out.println(s.getTables());

             

            For my VDB setup, this returns:

            {test_bulk=Table name=test_bulk, nameInSource=null, uuid=tid:555892ee3291-b9a0d09f-00000001}

             

            Is there a way to just grab the table name and only return "test_bulk"?  Right now I am just walking through the String to return just the pure table name,  but was curious is Teiid had it built-in and I am missing it.

             

            Thanks

            • 3. Re: Gathering Metadata
              Ramesh Reddy Master

              Devin,

               

              If you are just looking for table names along with column information and procedures along with parameter info, you can use JDBC metadata object. Look at "DatabaseMetadata" class, that you can retrieve on JDBC connection, by using "getMetadata" method.

               

              If you need full schema (including the view, and its transformations etc) above is only way.

               

              Ramesh..

              1 of 1 people found this helpful
              • 4. Re: Gathering Metadata
                devin pinkston Newbie

                Thanks Ramesh!