1 2 Previous Next 19 Replies Latest reply on Jan 17, 2013 1:07 PM by shawkins

    VDB reuse how to use (other than reading) virtual model?

    m.ardito

      hi!

       

      i'm trying to learn vdb reuse cababilities in XML vdb through DDL, as explained here and here

       

      i basically referred to this example, shown there:

      <model visible = "true" type = "VIRTUAL" name = "customers">

       

           <metadata type = "DDL"><![CDATA[

                    CREATE VIEW PARTS (

                         PART_ID integer PRIMARY KEY,

                         PART_NAME varchar(255),

                         PART_COLOR varchar(30),

                         PART_WEIGHT varchar(255)

                     ) AS

                        select a.id as PART_ID, a.name as PART_NAME, b.color as PART_COLOR, b.weight as PART_WEIGHT from modelA.part a, modelB.part b where a.id = b.id

           ]]>

           <metadata>

      </model>

       

      as a template for my tests and i succeeded creating a "reuse" vbd like this

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <vdb name="reuse" version="1">

          <import-vdb name="Testmix" version="1" import-data-policies="false"/>

          <model visible="true" type="VIRTUAL" name="new-model">

               <metadata type = "DDL"><![CDATA[

                    CREATE VIEW x (

                      conto varchar,

                      descrizione varchar

                      ) AS

                        select cc.conto_pdc, coa.description from TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa inner join  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc

               ]]>

               </metadata>

          </model>

      </vdb>

       

      (note: on localhost teeid instance i have a testmix xml vdb with 2 models: testmixMS (sql server) and  testmixMY (mysql) which works (now) perfectly both with JDBC and ODBC (squirrel, msaccess, msexcel) which gives me SQL access to objects like

      - TestmixMS.ApiMn.dbo.MA_ChartOfAccounts

      or

      - TestmixMY.conti_contratti)

       

      and it works! i can read the table with SQL and if in the "TestmixMY" source mysql DB table "conti_contratti" i add a new row, the "reuse" virtual model sees it perfectly.

       

      BUT

       

      i am now for the first time facing the concept of: how can i use such a virtual table, other than reading values as if it was a VIEW?

      - can i update single field values? if i try to update the "conto" field of an existing record, i get

      "Error: TEIID30492 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30492 Metadata does not allow updates on the group: x

      SQLState:  50000

      ErrorCode: 30492"

       

      so, is there any other way to create/update/delete records with this kind of setup, or do i need to create a "full" vdb through the designer? or?

       

      you will excuse my newbieness

       

      btw teiid is SO cool... thanks for it!

       

      [edit]

      i've just seen that there are options in DDL that allow table/views and also columns to be "updatable", at least, so that could be the way obvioulsy, but apart from the simple example on top of the "vdb reuse" page is there any other slightly more complex example i can follow (the below "read twitter" example is too much for me now, perhaps...) . is there any docs around which explains those values with examples? perhaps i'm askin too much uh?

      [/edit]

       

      Marco

        • 1. Re: VDB reuse how to use (other than reading) virtual model?
          rareddy

          see for some more exaamples at https://github.com/teiid/teiid-quickstarts

          1 of 1 people found this helpful
          • 2. Re: VDB reuse how to use (other than reading) virtual model?
            m.ardito

            ok i'm digging there, in the meanwhile i updated the vdb with this xml

             

            <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

            <vdb name="reuse" version="1">

                <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                <model visible="true" type="VIRTUAL" name="new-model">

                     <metadata type = "DDL"><![CDATA[

                          CREATE VIEW x (

                            conto varchar OPTIONS (UPDATABLE 'TRUE'),

                            descrizione varchar

                            ) OPTIONS (UPDATABLE 'TRUE') AS

                              select cc.conto_pdc, coa.description from TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa inner join  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc

                     ]]>

                     </metadata>

                </model>

            </vdb>

             

            which loads correctly and now

             

            trying to update the field "conto" i get

             

            "Error: TEIID30492 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30492 TEIID30061 Update is not allowed on the view x.  A procedure may be needed to handle the Update since: The updatable view has no valid target for UPDATEs.

            SQLState:  50000

            ErrorCode: 30492"

             

            and i don't understand what it's referring to when it says "The updatable view has no valid target for UPDATEs." ?

             

            Marco

            • 3. Re: VDB reuse how to use (other than reading) virtual model?
              shawkins

              See https://docs.jboss.org/author/display/TEIID/Updatable+Views

               

              We expect the update to be mapped to a simple query or a key preserving table that way we know that the application of the update will be only to the desired rows exposed by the view.  In this case is there a pk/fk relationship between your tables?

               

              Steve

              1 of 1 people found this helpful
              • 4. Re: VDB reuse how to use (other than reading) virtual model?
                m.ardito

                We expect the update to be mapped to a simple query or a key preserving table that way we know that the application of the update will be only to the desired rows exposed by the view.  In this case is there a pk/fk relationship between your tables?

                mmm,

                the source table (mysql) has 5 field and the field i'm trying to update is PK but the virtual view joins this table with another model (mssql) so this last can't have FK to that PK, i guess...

                i'm not sure to have understood what you were referring to...

                 

                in the meanwhile i created a "CREATE TRIGGER ON x INSTEAD OF INSERT AS" DDL statement

                and, adding ALL the source table fields, and using ALL of them in the insert query i can insert new records in the view...

                i added "NEW.conto, NEW.descrizione, NEW.contratto, NEW.eccezione, NEW.note" as new row targets,

                but i hope i can use instead of some NEW.<view field>, some default values or nulls if allowed in the source table. may i?

                 

                Perhaps is clearer showing the VDB as it is now

                 

                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                <vdb name="reuse" version="1">

                    <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                    <model visible="true" type="VIRTUAL" name="new-model">

                         <metadata type = "DDL"><![CDATA[

                            CREATE VIEW x (

                            conto varchar,

                            descrizione varchar,

                            contratto varchar,

                            eccezione boolean,

                            note varchar

                            ) OPTIONS (UPDATABLE 'TRUE') AS

                            SELECT

                                cc.conto_pdc,

                                coa.description,

                                cc.tipo_contratto,

                                cc.eccezione,

                                cc.note

                            FROM  TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa

                            INNER JOIN  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc;

                                 

                            CREATE TRIGGER ON x INSTEAD OF INSERT AS

                            FOR EACH ROW

                            BEGIN ATOMIC

                            INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto, NEW.descrizione, NEW.contratto, NEW.eccezione, NEW.note);

                            END;                 

                         ]]>

                         </metadata>

                    </model>

                </vdb>

                 

                could i use instead of "INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto, NEW.descrizione, NEW.contratto, NEW.eccezione, NEW.note);"

                something like "INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto,NULL, NULL, NULL, NULL);"

                or better just specify NEW.conto and let the source table use its default values, if any, but how?

                 

                but the best of all would be to have an "inherently updatable" view, as the doc says, if possible...

                 

                 

                 

                Thanks,

                Marco

                • 5. Re: VDB reuse how to use (other than reading) virtual model?
                  shawkins

                  Given the error "The updatable view has no valid target for UPDATEs", we actually have a more basic problem.  You need to make sure that the views/tables you intend to update through view x are also marked as updatable in their OPTIONS clause metadata.  UPDATABLE defaults to false since we have historically been used in a mostly read capacity and having the updatability as false prevents much of the need to use higher level constructs such as data roles to restrict access.  However in simple scenarios it can be cumbersome to explicitly mark each table/view as updatable.

                   

                  Once you marked the view definitions tables as updatable and you are using the view as inherently updatable, the next issue you may see would look like "The specified change set [conto] against an inherently updatable view does not map to a key preserving group."  That is what I was refering to with the pk/fk question.

                   

                  > the source table (mysql) has 5 field and the field i'm trying to update is PK but the virtual view joins this table with another model (mssql) so this last can't have FK to that PK, i guess...

                   

                  Yes you can add primary/foreign keys to views and across models if needed.  We will not enforce the referential integretity, but we will use the metadata to help us make planning decisions such as this one. 

                   

                  Given "select cc.conto_pdc, coa.description from TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa inner join  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc"

                   

                  If conto_pdc is a unique/primary key and coa.Account is marked as a foreign key to conto_pdc, then the update should proceed using the inherent update logic.

                   

                  > could i use instead of "INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto, NEW.descrizione, NEW.contratto, NEW.eccezione, NEW.note);"

                   

                  The new values are determined from your insert sql, so they will either be the values you entered or the default for the column (which should be null, but I can see that our DDL based metadata has an issue though that we need the nullablity to default to null - I'll correct that) that can be specified using a default clause - "descrizione varchar DEFAULT 'xyz'".  Due to legacy metadata issues you can currently only enter a string literal default value that is intepretted as a literal value - no expressions.

                   

                  > something like "INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto,NULL, NULL, NULL, NULL);"

                   

                  That would just enter null for each of the other fields.

                   

                  > or better just specify NEW.conto and let the source table use its default values, if any, but how?

                   

                  There is also a CHANGING group in the scope of INSERT/UPDATE for each row triggers that indicates if the value was actually entered in the user sql.  So what it sound like you want to do is:

                   

                  INSERT INTO TestmixMY.conti_contratti VALUES (NEW.conto, CASE WHEN CHANGING.descrizone THEN NEW.descrizione ELSE DEFAULT END, ...

                   

                  Unfortunately we don't yet support the INSERT DEFAULT contruct and this would be non-standard usage, since it normally would need to be the entire value expression and not as part of an expression.  You can achieve the same affect though the use of dynamic sql if needed. 

                   

                  Another option depending upon your goal is to explicitly mark the other columns as non updatable - i.e. "descrizione varchar OPTIONS (UPDATABLE 'FALSE')," which will make them invalid as an insert/update target.  You can then change your underlying insert to "INSERT INTO TestmixMY.conti_contratti (conto_pdc) VALUES (NEW.conto);"

                  • 6. Re: VDB reuse how to use (other than reading) virtual model?
                    shawkins

                    Nevermind what I was saying about column nullability.  It will appropriately default to the nullability of the data type.  I had forgotten that the logic changed with TEIID-2150.

                    • 7. Re: VDB reuse how to use (other than reading) virtual model?
                      m.ardito

                      > You need to make sure that the views/tables you intend to update through view x are also marked as updatable in their OPTIONS clause metadata. 

                      > UPDATABLE defaults to false since we have historically been used in a mostly read capacity and having the updatability as false prevents

                      > much of the need to use higher level constructs such as data roles to restrict access. 

                      > However in simple scenarios it can be cumbersome to explicitly mark each table/view as updatable.

                       

                      my "source" VDB are (directly) writable, and i did not set up any UPDATABLE flag other than for the reuse VDB...

                      i can directly delete/update data from a VDB accessing a single DS (mysql5-connector)...

                      like

                      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                      <vdb name="Testmysql" version="1">

                          <description>Test VDB</description>

                          <property name="UseConnectorMetadata" value="true" />

                           <model name="Testmysql">

                              <property name="importer.useFullSchemaName" value="false"/>

                              <source name="mysql5-connector" translator-name="mysql5" connection-jndi-name="java:/testmysql"/>

                          </model>

                      </vdb>

                       

                      about the "reuse" VDB, whole structure follows

                      - 2 DS (sqlserver-connector and mysql5-connector)

                      - a "testmix" VDB that composites those 2 DS like:

                       

                      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                      <vdb name="Testmix" version="1">

                          <description>Test Mix VDB</description>

                          <property name="UseConnectorMetadata" value="true" />

                           <model name="TestmixMS">

                              <property name="importer.useFullSchemaName" value="true"/>

                              <source name="sqlserver-connector" translator-name="sqlserver" connection-jndi-name="java:/magoDS"/>

                          </model>

                           <model name="TestmixMY">

                              <property name="importer.useFullSchemaName" value="false"/>

                              <source name="mysql5-connector" translator-name="mysql5" connection-jndi-name="java:/testmysql"/>

                          </model>

                      </vdb>

                       

                      - then i have the "reuse" VDB which is now

                       

                      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                      <vdb name="reuse" version="1">

                          <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                          <model visible="true" type="VIRTUAL" name="new-model">

                              <metadata type = "DDL"><![CDATA[

                                  CREATE VIEW x (

                                  conto varchar,

                                  descrizione varchar

                                  ) OPTIONS (UPDATABLE 'TRUE') AS

                                  SELECT

                                      cc.conto_pdc,

                                      coa.description

                                  FROM  TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa

                                  INNER JOIN  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc;

                              ]]>

                              </metadata>

                          </model>

                      </vdb>

                       

                      and executing

                      "update x set conto='123456778' where conto='05061003';"

                       

                      i still get

                      "Error: TEIID30492 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30492 TEIID30061 Update is not allowed on the view x.  A procedure may be needed to handle the Update since: The updatable view has no valid target for UPDATEs.

                      SQLState:  50000

                      ErrorCode: 30492"

                       

                      [edit]

                      i can, though, execute (through a "direct" VDB like

                      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                      <vdb name="Testmysql" version="1">

                          <description>Test VDB</description>

                          <property name="UseConnectorMetadata" value="true" />

                           <model name="Testmysql">

                              <property name="importer.useFullSchemaName" value="false"/>

                              <source name="mysql5-connector" translator-name="mysql5" connection-jndi-name="java:/testmysql"/>

                          </model>

                      </vdb>

                       

                      ( i hilighted fieds that are referred in the above "reuse" VDB...)

                       

                      "insert into conti_contratti(conto_pdc) values ('01230123')"

                      and then

                      "update conti_contratti set conto_pdc='78978901' where conto_pdc='01230123'"

                       

                      and this works...

                       

                      what can be wrong with the reuse VDB?

                      • 8. Re: VDB reuse how to use (other than reading) virtual model?
                        m.ardito

                        i also explicitly changed the reuse to specify the fields updatability like:

                         

                        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                        <vdb name="reuse" version="1">

                            <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                            <model visible="true" type="VIRTUAL" name="new-model">

                                <metadata type = "DDL"><![CDATA[

                                    CREATE VIEW x (

                                    conto varchar OPTIONS (UPDATABLE 'TRUE') ,

                                    descrizione varchar OPTIONS (UPDATABLE 'FALSE')

                                    ) OPTIONS (UPDATABLE 'TRUE') AS

                                    SELECT

                                        cc.conto_pdc,

                                        coa.description

                                    FROM  TestmixMS.ApiMn.dbo.MA_ChartOfAccounts as coa

                                    INNER JOIN  TestmixMY.conti_contratti as cc on coa.Account = cc.conto_pdc;

                                ]]>

                                </metadata>

                            </model>

                        </vdb>

                         

                        but

                        executing

                        "update x set conto='123456778' where conto='05061003';"

                         

                        i still get

                        "Error: TEIID30492 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30492 TEIID30061 Update is not allowed on the view x.  A procedure may be needed to handle the Update since: The updatable view has no valid target for UPDATEs.

                        SQLState:  50000

                        ErrorCode: 30492"

                        • 9. Re: VDB reuse how to use (other than reading) virtual model?
                          m.ardito

                          i have probably found the answer (will still wait for some confirmation, though )

                           

                          i noticed this line in the "reuse" VDB

                           

                          <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                           

                          and just switching it to

                           

                          <import-vdb name="Testmix" version="1" import-data-policies="true"/>

                           

                          my updates are working like a charm!

                           

                          i just guessed it could be "read-write" related (pat myself on my back)...

                           

                          Marco

                          • 10. Re: VDB reuse how to use (other than reading) virtual model?
                            shawkins

                            > my "source" VDB are (directly) writable, and i did not set up any UPDATABLE flag other than for the reuse VDB...

                            > i can directly delete/update data from a VDB accessing a single DS (mysql5-connector)...

                             

                            Yes, that should be the case.  I was confused from the earlier post and thought that 1 or both of the table references in the x join were views and thus needed to be marked as updatable. 

                             

                            > - then i have the "reuse" VDB which is now

                             

                            Accessing through a reuse VDB should not be the root issue as the metadata is shared between the original vdb and the importing vdb.  As you show below you can directly issue the update against the desired table through the reuse vdb and it works fine.

                             

                            > Error: TEIID30492 Remote org.teiid.api.exception.query.QueryValidatorException: TEIID30492 TEIID30061 Update is not allowed on the view x.  A procedure may be needed to handle the Update since: The updatable view has no valid target for UPDATEs

                             

                            I can see that the error message is too general.  It is a little better if you were to do something similar on the designer side.  Essentially for an inherently updatable join to work MA_ChartOfAccounts and conti_contratti must both have a unique/primary key and the table that you are actually updating (conti_contratti) must be key preserving - which means there needs to be a foreign key constraint from conti_contratti to MA_ChartOfAccounts (see the Reference for more).  Assuming that is a correct description of the scenario, your situation needs aditional metadata as your tables are from different sources.  Here is an update to the above that adds views with pk/fk metadata:

                             

                                    <metadata type = "DDL"><![CDATA[

                                       CREATE VIEW vw_MA_ChartOfAccounts (Account varchar PRIMARY KEY, description varchar) OPTIONS (UPDATABLE true) AS SELECT * FROM TestmixMS.ApiMn.dbo.MA_ChartOfAccounts;

                             

                                       CREATE VIEW vw_conti_contratti (conto_pdc varchar PRIMARY KEY, FOREIGN KEY (conto_pdc) REFERENCING vw_MA_ChartOfAccounts (Account) ) OPTIONS (UPDATABLE true) AS SELECT * FROM TestmixMY.conti_contratti;

                             

                                        CREATE VIEW x (

                                        conto varchar

                                        descrizione varchar

                                        ) OPTIONS (UPDATABLE 'TRUE') AS

                                        SELECT

                                            cc.conto_pdc,

                                            coa.description

                                        FROM  vw_MA_ChartOfAccounts as coa

                                        INNER JOIN  vw_conti_contratti as cc on coa.Account = cc.conto_pdc;

                                    ]]>

                                    </metadata>

                             

                            The vw_ views now express a relationship between the joined tables that the inherently updatable view logic should understand.

                             

                            > i have probably found the answer (will still wait for some confirmation, though )

                             

                            Changing the import data policies flag should not have any effect for you since you are are not using data roles.  That flag controls whether you want the imported data roles, which would also be defined in the vdb.xml applied to the importing vdb.

                             

                            Steve

                            • 11. Re: VDB reuse how to use (other than reading) virtual model?
                              m.ardito

                              >> i have probably found the answer (will still wait for some confirmation, though )

                              >Changing the import data policies flag should not have any effect for you since you are are not using data roles.  That flag controls whether you want the imported data roles, which would also be defined in the vdb.xml applied to the importing vdb.

                               

                              you were right about this my "successful" (not) update was using the source model directly , i didn't notice...

                               

                              > assuming that is a correct description of the scenario, your situation needs aditional metadata as your tables are from different sources.  Here is an update to the above that adds views with pk/fk metadata:

                               

                              i tried to update your example to reflect my scenario (one table has 28 fields, the other 5)

                              reading some deploying errors i just had to correct some keywords syntax which i report here just for clarity:

                              REFERENCING > REFERENCES

                              UPDATABLE true > UPDATABLE 'TRUE'

                               

                              and it became something like this which

                              * is deployed without errors, marked VALID

                              * is permanently set to status LOADING, still after 5 minutes...  does not change after reload/refresh...

                              * returns no SCHEMAS in squirrel, i can connect, though... there is no "x" table/view (there is nothing )

                               

                              is something still wrong... somewhere?

                               

                              <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

                              <vdb name="reuse" version="1">

                                  <import-vdb name="Testmix" version="1" import-data-policies="false"/>

                                  <model visible="true" type="VIRTUAL" name="new-model">   

                                      <metadata type = "DDL"><![CDATA[

                                          CREATE VIEW vw_coa (

                                              Account varchar PRIMARY KEY,

                                              description varchar,

                                              CodeType    integer,

                                              PostableInJE    string,

                                              Ledger    string,

                                              Notes    string,

                                              Disabled    string,

                                              PostableInCostAcc    string,

                                              DebitCreditSign    integer,

                                              UoM    string,

                                              CostCentersDistribution    integer,

                                              JobsDistribution    integer,

                                              DirectCost    integer,

                                              FullCost    integer,

                                              InCurrency    string,

                                              Currency    string,

                                              DeferralsAccount    string,

                                              DeferralsDays    short,

                                              AccrualsAccount    string,

                                              AccrualsDays    short,

                                              CostAccAccountGroup    string,

                                              TBGuid    string,

                                              TBCreated    timestamp,

                                              TBModified    timestamp,

                                              PreferredSignForBalance    integer,

                                              TBCreatedID    integer,

                                              TBModifiedID    integer,

                                              CashFlowType    integer

                                              ) OPTIONS (UPDATABLE 'TRUE')

                                              AS

                                              SELECT *

                                              FROM TestmixMS.ApiMn.dbo.MA_ChartOfAccounts;

                                             

                                          CREATE VIEW vw_cc (

                                              conto_pdc varchar PRIMARY KEY,

                                              descrizione varchar,

                                              tipo_contratto varchar,

                                              eccezione boolean,

                                              note varchar,

                                              FOREIGN KEY (conto_pdc) REFERENCES vw_coa (Account)

                                              ) OPTIONS (UPDATABLE 'TRUE')

                                              AS

                                              SELECT * FROM TestmixMY.conti_contratti;

                                         

                                          CREATE VIEW x (

                                              conto varchar,

                                              descrizione varchar

                                          ) OPTIONS (UPDATABLE 'TRUE') AS

                                          SELECT

                                              cc.conto_pdc,

                                              coa.description

                                          FROM  vw_coa as coa

                                          INNER JOIN  vw_cc as cc on coa.Account = cc.conto_pdc;

                                      ]]>

                                      </metadata>

                                  </model>

                              </vdb>

                              • 12. Re: VDB reuse how to use (other than reading) virtual model?
                                m.ardito

                                the server log, deploying (VALID but LOADING "reuse" VDB):

                                 

                                S015876: Starting deployment of "reuse-vdb.xml"

                                17:32:31,766 INFO  [org.teiid.RUNTIME] (MSC service thread 1-1) TEIID50029 VDB r

                                euse.1 model "new-model" metadata is currently being loaded. Start Time: 14/01/1

                                3 17.32

                                17:32:31,775 INFO  [org.teiid.RUNTIME] (teiid-async-threads - 1) TEIID50030 VDB

                                reuse.1 model "new-model" metadata loaded. End Time: 14/01/13 17.32

                                17:32:31,790 ERROR [org.jboss.threads.executor] (teiid-async-threads - 1) Task e

                                xecution failed for task org.teiid.jboss.VDBService$6@16b4d79: java.lang.Illegal

                                ArgumentException: Expected argument to be non-null but got null

                                        at org.teiid.core.util.ArgCheck.isNotNull(ArgCheck.java:303) [teiid-comm

                                on-core-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.core.util.ArgCheck.isNotNull(ArgCheck.java:289) [teiid-comm

                                on-core-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.core.util.ArgCheck.isInstanceOf(ArgCheck.java:349) [teiid-c

                                ommon-core-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.core.util.ArgCheck.isInstanceOf(ArgCheck.java:338) [teiid-c

                                ommon-core-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.TransformationMetadata.getElementIDsInKey(Tr

                                ansformationMetadata.java:683) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.TempMetadataAdapter.getElementIDsInKey(TempM

                                etadataAdapter.java:486) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.optimizer.relational.rules.RuleRaiseAccess.matchesFor

                                eignKey(RuleRaiseAccess.java:728) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.resolver.util.ResolverUtil.findKeyPreserved(ResolverU

                                til.java:1058) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.resolver.util.ResolverUtil.findKeyPreserved(ResolverU

                                til.java:1018) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.resolver.util.ResolverUtil.findKeyPreserved(ResolverU

                                til.java:921) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.validator.UpdateValidator.internalValidate(UpdateVali

                                dator.java:462) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.validator.UpdateValidator.validate(UpdateValidator.ja

                                va:366) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.resolver.QueryResolver.resolveView(QueryResolver.java

                                :447) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.MetadataValidator.validate(MetadataValidator

                                .java:297) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.MetadataValidator.access$100(MetadataValidat

                                or.java:64) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.MetadataValidator$ResolveQueryPlans.execute(

                                MetadataValidator.java:202) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.query.metadata.MetadataValidator.validate(MetadataValidator

                                .java:84) [teiid-engine-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.deployers.VDBRepository.finishDeployment(VDBRepository.java

                                :289) [teiid-runtime-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.runtime.AbstractVDBDeployer.metadataLoaded(AbstractVDBDeplo

                                yer.java:170) [teiid-runtime-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.jboss.VDBService.access$900(VDBService.java:91) [teiid-jbos

                                s-integration-8.2.0.Final.jar:8.2.0.Final]

                                        at org.teiid.jboss.VDBService$6.run(VDBService.java:394) [teiid-jboss-in

                                tegration-8.2.0.Final.jar:8.2.0.Final]

                                        at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.j

                                ava:33)

                                        at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)

                                        at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)

                                        at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:842)

                                        at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_09]

                                        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

                                 

                                17:32:31,906 INFO  [org.jboss.as.server] (HttpManagementService-threads - 30) JB

                                AS018559: Deployed "reuse-vdb.xml"

                                • 13. Re: VDB reuse how to use (other than reading) virtual model?
                                  shawkins

                                  > i tried to update your example to reflect my scenario (one table has 28 fields, the other 5)

                                   

                                  Yes, it should be REFERENCE.  In Teiid 8.2 and later you can use non-string expressions, such as TRUE/FALSE, etc. in the OPTIONS clause.

                                   

                                  >  is deployed without errors, marked VALID

                                   

                                  That may not yet be reflective of the final validity if it is still loading.

                                   

                                  > returns no SCHEMAS in squirrel, i can connect, though... there is no "x" table/view (there is nothing )

                                   

                                  If you are still loading then you would either block or throw an exception.   You would not expect to see anything.

                                   

                                  >  is permanently set to status LOADING, still after 5 minutes...  does not change after reload/refresh...

                                   

                                  In theory that should not be related to this metadata change as you simply are adding a couple of view defintions and I can make a similar secnario work quite easily.  You will need to check the status of the imported vdb to see if there is an issue there.  If the imported vdb fails to load properly, then the importing vdb will similarly have an issue.

                                  • 14. Re: VDB reuse how to use (other than reading) virtual model?
                                    m.ardito

                                    all i got is the above error in the server console (cli) which says

                                     

                                    S015876: Starting deployment of "reuse-vdb.xml"

                                    17:32:31,766 INFO  [org.teiid.RUNTIME] (MSC service thread 1-1) TEIID50029 VDB r

                                    euse.1 model "new-model" metadata is currently being loaded. Start Time: 14/01/1

                                    3 17.32

                                    17:32:31,775 INFO  [org.teiid.RUNTIME] (teiid-async-threads - 1) TEIID50030 VDB

                                    reuse.1 model "new-model" metadata loaded. End Time: 14/01/13 17.32

                                    17:32:31,790 ERROR [org.jboss.threads.executor] (teiid-async-threads - 1) Task e

                                    xecution failed for task org.teiid.jboss.VDBService$6@16b4d79: java.lang.Illegal

                                    ArgumentException: Expected argument to be non-null but got null

                                    .

                                    .

                                    [error stack trace]

                                    .

                                    .

                                    17:32:31,906 INFO  [org.jboss.as.server] (HttpManagementService-threads - 30) JB

                                    AS018559: Deployed "reuse-vdb.xml"

                                     

                                    i checked both DS, they're fine, i can use them anywhere but in the "reuse" vdb... will look further for errors or else...

                                    1 2 Previous Next