Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Liquibase Redshift loadUpdateData

$
0
0
Hi all,

I'm trying to create an AWS Redshift DB with data taken from a number of different CSV files.

I've tested the script locally using Postgres and all seems to be working well (produces the following types of output:
  1. DO
  2. $$
  3. BEGIN
  4. UPDATE public.example_db SET name = 'abc' WHERE other_name = '123';
  5. IF not found THEN
  6. INSERT INTO public. example_db (name, other_name) VALUES ('abc, '123');
  7. END IF;
  8. END;
  9. $$
  10. LANGUAGE plpgsql;
)

HOWEVER, when running this against a Redshift DB, it generates the standard insert:

  1. INSERT INTO public.example_db (name, other_name) VALUES ('abc', '123');
My changeset xml looks like this:

  1. <changeSet id="2.1" author="example" runOnChange="true">

  2.       <loadData file="/resources/002_resources/files/net_names.csv"
  3.                 schemaName="public"
  4.                 tableName="example_db">
  5.       </loadData>

  6.       <loadUpdateData file="/resources/002_resources/files/others.csv"
  7.                 schemaName="public"
  8.                 primaryKey="name"
  9.                 tableName="example_db">
  10.       </loadUpdateData>

  11.       <loadUpdateData file="/resources/002_resources/files/more.csv"
  12.                 schemaName="public"
  13.                 primaryKey="name"
  14.                 tableName="example_db">
  15.       </loadUpdateData>

  16.       <loadUpdateData file="/resources/002_resources/files/foo_bar.csv"
  17.                 schemaName="public"
  18.                 primaryKey="name"
  19.                 tableName="example_db">
  20.       </loadUpdateData>

  21.       <sqlFile path="../resources/002_resources/fill_in_nulls.sql" relativeToChangelogFile="true" />

  22.       <rollback>
  23.           <sqlFile path="../resources/002_resources/rollback.sql" relativeToChangelogFile="true" />
  24.       </rollback>

  25.   </changeSet>
Any ideas on what i can do to get this working? I run liquibase like:
  1. liquibase --defaultsFile=../../IdeaProjects/migrations/sandbox.properties updateSQL

With the defaults file containing the following information:

  1. url=jdbc:redshift://amazonURL.com:1234/dbName?ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory
    driver=com.amazon.redshift.jdbc41.Driver
    databaseClass=liquibase.ext.redshift.database.RedshiftDatabase
    username=123
    password=abc
    defaultSchemaName=public
    changeLogFile=changelog.xml
Any help would be greatly appreciated. If you need any extra information please let me know!

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>