ggeorgia
ggeorgia

Reputation: 31

Liquibase looks for a strange path, when loading data from csv and throws an error

Liquibase version: 4.7

The path that liquibase is looking for is a combination between the changeset path and the csv content.

Error message

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/v2_1_data_update.xml::20210206-1_local::beng:
     Reason: java.nio.file.InvalidPathException: Illegal char <"> at index 30: config/liquibase/changelog\[{ "attId": 0, "refSystem": "MOXIS",

Change set for loading the data, that is failing:

 <changeSet id="20210206-1_local" author="beng" context="dev" dbms="h2">
        <comment>load moxis documents test data for internal users 21-30</comment>
        <loadData encoding="UTF-8"
                  file="config/liquibase/csv/dev/documentsmoxis_devh2.csv"
                  separator=";"
                  tableName="document">
            <column name="visible_until" type="datetime"/>
            <column name="document_date" type="date"/>
            <column name="expires_on" type="datetime"/>
            <column name="form" type="boolean"/>
            <column name="check_processed" type="boolean"/>
        </loadData>
    </changeSet>

Adding the last 3 columns to the table:

<changeSet id="20210204-1" author="beng">
        <comment>Adding action_required,ref_system,attachments columns to table document</comment>
        <addColumn tableName="document">
            <column name="action_required" type="varchar(255)">
                <constraints nullable="true"/>
            </column>
            <column name="ref_system" type="varchar(255)">
                <constraints nullable="true"/>
            </column>
            <column name="attachments" type="clob">
                <constraints nullable="true"/>
            </column>
        </addColumn>
    </changeSet>

Csv file, from where the data is loaded

csv file

Upvotes: 2

Views: 1071

Answers (1)

Andrey B. Panfilov
Andrey B. Panfilov

Reputation: 6111

If my memory serves me right LB considers column config in changeset as a "hint", but the real load scenario is based on column config, table metadata and CVS, in your case attachments column is present in table and has LOB type, so LB assumes that you are trying to load LOB from file. Try explicitly exclude attachments column from loading:

<column name="attachments" type="skip"/>

Upvotes: 1

Related Questions