Querying references in loaddata

I have some 2 csv files, the second having references to the first. I’d like to import them using loaddata. The references should point to the (to be generated) primary keys of the first table, but in the csv file the reference points to another (unique) field. Is that possible?

I would e.g. need something like

<loadData catalogName=“team” …>

<loadData catalogName=“member” …>
<column header=“teamName” name=“teamId” valueComputed=“SELECT (ID) FROM team WHERE name={teamName}” …/>

I’ve found the solution - but not via the documentation (which should imho be improved on this point). See https://forum.liquibase.org/t/loaddata-csv-computedvalue/4035:

such columns must be defined as “computed” in loadData - e.g.
<column header=“teamName” type=“computed” …

and the csv files needs to provide the sql statement in that column - e.g.
…;teamName;…
…;SELECT ID from team WHERE name=‘my Teamname’;…

such loadData statements have to be defined as usePreparedStatements=“false”, otherwise they will not run

Thanks @Sebastian for sharing the answer.

I agree, this point could be added in the documentation. It will definitely help users tryign out similar thing.

Thanks,
Rakhi Agrawal