3 Replies Latest reply on Jun 17, 2019 3:30 PM by rareddy

    Source Details for Dyanmic VDB.

    mahavird

      Hi Team,

       

      We are having a Dynamic VDB.

      We need to know the below details of Dynamic VDB for all the models via Java Code...

       

      1. What are the table the model refers in source for each model.

      2. What are the columns in source it refers in each table.

      3. column name and data types of each column.

       

      Thanks,

      Mahavir

        • 1. Re: Source Details for Dyanmic VDB.
          rareddy

          > We need to know the below details of Dynamic VDB for all the models via Java Code...

          so, are you using "teiid-spring-boot"? otherwise, can you explain "via Java Code..."?

           

          >1. What are the table the model refers in source for each model.

          >2. What are the columns in source it refers in each table.

          >3. column name and data types of each column.

           

          These questions are vague, a model or schema refers to an external data source and its metadata that you configured in the Dynamic VDB. The tables and its columns are what you imported or designed to be (if you are using direct DDL to define them). Once they are defined they represent the tables/procedures of that external source, these we call "physical" models. You can also define a "virtual" model, where you define a model/schema and define virtual Views/Procedures based on tables/procedures from physical models.

           

          Take look this About Teiid | Teiid  look at Teiid Basics section about Virtual Databases and Models.

          • 2. Re: Source Details for Dyanmic VDB.
            mahavird

            Hi Ramesh Reddy,

             

            Thanks for the reply.

            We are having VDB written in dynamic VDB script.
            We are writing a web application to display details of the VDB for persentation.

            Below is the steps I am performing...

            1. adminObject = AdminFactory.getInstance().createAdmin(...)

            Here I am opening the admin object.

            2. Collection<VDB> vdbs = (Collection<VDB>)adminObject.getVDBs();

            Here I am getting a VDB list from the admin object.

            3. VDB v = vdbs.get(0);

            Here I am getting the first VDB.

            3. List<Model> m = v.getModels();

            Here I am getting the list of models.

            4.
            for(Model model : m)

              if(model.getModelType() == Model.Type.VIRTUAL)
              {
               EnumSet<SchemaObjectType> es = EnumSet.of(SchemaObjectType.PROCEDURES,SchemaObjectType.TABLES);
               str = adminObject.getSchema(v.getName(), v.getVersion(), model.getName(),es, null);
               MetadataFactory mf;
               Properties properties =new Properties();
               mf = new MetadataFactory(v.getName(), v.getVersion(),model.getName(), SystemMetadata.getInstance().getRuntimeTypeMap(),properties, null);
               
               QueryParser.getQueryParser().parseDDL(mf, str);

               Schema s = mf.getSchema();

               //Here I am getting procedures and table details from schema variable s.
              } 
             
            }

            5. My Question is...

            1. parseDDL is getting error because str has a reserved word in one of the column.
            2. There is a table with column name "server" which is a reserved word.
            3. So I am getting a error in parseDDL() call.

            Please suggest how to solve this error.

             

            Thanks
            Mahavir

            • 3. Re: Source Details for Dyanmic VDB.
              rareddy

              The returned string "getSchema" call should have been property escaping the "server" keyword like in double quotes. If this not happening then it is bug, you log an issue on Teiid JIRA at Teiid - JBoss Issue Tracker

               

              as a workaround, if you can wrap in double quotes it should work.

               

              Ramesh..