[teiid-issues] [JBoss JIRA] (TEIID-5269) Odata4 metadata roundtrip is not in place

Steven Hawkins (JIRA) issues at jboss.org
Wed Feb 28 10:49:00 EST 2018


     [ https://issues.jboss.org/browse/TEIID-5269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on TEIID-5269 started by Steven Hawkins.
---------------------------------------------
> Odata4 metadata roundtrip is not in place
> -----------------------------------------
>
>                 Key: TEIID-5269
>                 URL: https://issues.jboss.org/browse/TEIID-5269
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors, OData
>    Affects Versions: 8.12.12.6_4
>            Reporter: Jan Stastny
>            Assignee: Steven Hawkins
>
> Teiid should be able to import (using odata4 translator) metadata exposed by its own odata4 interface.
> Currently there is following identified discrepancy.
> Foreign keys are not properly carried through the expose/import roundtrip. After importing metadata from odata4 endpoint for another vdb (all in single instance), the resulting metadata lacks FK definitions.
> For following data exposed in a VDB:
> {code:sql}
>             CREATE VIEW A(a_id integer PRIMARY KEY, a_value string) AS SELECT 1, 'a1' UNION ALL SELECT 2, 'a2';
>             CREATE VIEW B(b_id integer PRIMARY KEY, b_value string) AS SELECT 3, 'b1' UNION ALL SELECT 4, 'b2';
>             CREATE VIEW C(c_id integer PRIMARY KEY, a_ref integer, b_ref integer,
>             FOREIGN KEY (a_ref) REFERENCES A(a_id),
>             FOREIGN KEY (b_ref) REFERENCES B(b_id))
>             AS SELECT 5, 1, 3 UNION ALL SELECT 6, 2, 4;
> {code}
> the following odata4 metadata are served:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
>   <edmx:Reference Uri="http://localhost:8080/odata4/static/org.apache.olingo.v1.xml">
>     <edmx:Include Namespace="org.apache.olingo.v1" Alias="olingo-extensions"/>
>   </edmx:Reference>
>   <edmx:DataServices>
>     <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="teiid5221data.1.data" Alias="data">
>       <EntityType Name="A">
>         <Key>
>           <PropertyRef Name="a_id"/>
>         </Key>
>         <Property Name="a_id" Type="Edm.Int32" Nullable="false"/>
>         <Property Name="a_value" Type="Edm.String" MaxLength="4000"/>
>         <NavigationProperty Name="C_FK0" Type="Collection(data.C)"/>
>       </EntityType>
>       <EntityType Name="B">
>         <Key>
>           <PropertyRef Name="b_id"/>
>         </Key>
>         <Property Name="b_id" Type="Edm.Int32" Nullable="false"/>
>         <Property Name="b_value" Type="Edm.String" MaxLength="4000"/>
>         <NavigationProperty Name="C_FK1" Type="Collection(data.C)"/>
>       </EntityType>
>       <EntityType Name="C">
>         <Key>
>           <PropertyRef Name="c_id"/>
>         </Key>
>         <Property Name="c_id" Type="Edm.Int32" Nullable="false"/>
>         <Property Name="a_ref" Type="Edm.Int32"/>
>         <Property Name="b_ref" Type="Edm.Int32"/>
>         <NavigationProperty Name="FK0" Type="data.A"/>
>         <NavigationProperty Name="FK1" Type="data.B"/>
>       </EntityType>
>       <EntityContainer Name="data">
>         <EntitySet Name="A" EntityType="data.A">
>           <NavigationPropertyBinding Path="C_FK0" Target="C"/>
>         </EntitySet>
>         <EntitySet Name="B" EntityType="data.B">
>           <NavigationPropertyBinding Path="C_FK1" Target="C"/>
>         </EntitySet>
>         <EntitySet Name="C" EntityType="data.C">
>           <NavigationPropertyBinding Path="FK0" Target="A"/>
>           <NavigationPropertyBinding Path="FK1" Target="B"/>
>         </EntitySet>
>       </EntityContainer>
>     </Schema>
>   </edmx:DataServices>
> </edmx:Edmx>
> {code}
> Then, when I import from the odata4 endpoint I get following:
> {code:sql}
> ===> SET NAMESPACE 'http://www.jboss.org/teiiddesigner/ext/odata/2012' AS teiid_odata;
> CREATE FOREIGN TABLE A (
> 	a_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
> 	a_value string,
> 	PRIMARY KEY(a_id)
> ) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.A', "teiid_odata:Type" 'ENTITY_COLLECTION');
> CREATE FOREIGN TABLE B (
> 	b_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
> 	b_value string,
> 	PRIMARY KEY(b_id)
> ) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.B', "teiid_odata:Type" 'ENTITY_COLLECTION');
> CREATE FOREIGN TABLE C (
> 	c_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
> 	a_ref integer OPTIONS (NATIVE_TYPE 'Edm.Int32'),
> 	b_ref integer OPTIONS (NATIVE_TYPE 'Edm.Int32'),
> 	PRIMARY KEY(c_id)
> ) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.C', "teiid_odata:Type" 'ENTITY_COLLECTION');
> {code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the teiid-issues mailing list