External types connected by multiple fields

#1

Hi,

we have two redshift-based external types.

entity type Type1 mixes External schema name ‘TABLE1’{

prop13: string schema name ‘field13’
prop14: string schema name ‘field14’

}

type Type2CompositeKey mixes CompositeKey{
prop23: string schema name ‘field23’
prop24: string schema name ‘field24’
}

entity type Type2 mixes Type2CompositeKey,External schema name ‘TABLE2’{


}

We would like to execute fetch requests on these types such that they execute a query similar to

SELECT … FROM TABLE1 LEFT JOIN TABLE2
ON TABLE1.field13=TABLE2.field23 AND TABLE1.field14=TABLE2.field24
WHERE …

How should they be connected?

0 Likes

#2

You should be able to change Type1 as follows:

entity type Type1 mixes External schema name ‘TABLE1’{

prop13: string schema name ‘field13’
prop14: string schema name ‘field14’

@schema(fieldOverrides = {prop23 : ‘field13’, prop24: ‘field14’})
type2Key: Type2CompositeKey

type2: Type2(id, type2Key)

}

1 Like