0

is there a way to pass the TEST.csv value from the command line

<preConditions onFail="MARK_RAN">
    <sqlCheck expectedResult="0">SELECT COUNT(1) FROM tb_mt_data_map;</sqlCheck>
</preConditions>
<loadData encoding="UTF-8"
          file= "TEST.csv"
          separator=";"
          quotchar="'"
          relativeToChangelogFile="true"
          tableName="tb_mt_data_map">
f_puras
  • 2,521
  • 4
  • 33
  • 38

1 Answers1

0

is there a way to pass the TEST.csv value from the command line

You can use Liquibase Property Substitution

Liquibase allows dynamic substitution of properties in changelog files. We can configure multiple properties inside a file and then use them wherever required. You can configure "csvFileName" and then use it in changesets with syntax ${csvFileName}.

You can either pass the property value from command line -DcsvFileName=Test.csv or you can configure it's value in liquibase.properties file.

csvFileName=Test.csv

Then you can use it in your changeset as follows:

<preConditions onFail="MARK_RAN">
    <sqlCheck expectedResult="0">SELECT COUNT(1) FROM tb_mt_data_map;</sqlCheck>
</preConditions>
<loadData encoding="UTF-8"
          file= "${csvFileName}"
          separator=";"
          quotchar="'"
          relativeToChangelogFile="true"
          tableName="tb_mt_data_map">

For more details on property substitution, have a look at my answer on this post

Rakhi Agrawal
  • 827
  • 7
  • 14