I’m trying to insert csv data. My config looks like this:
{
"description": "DS-5001: insert boundary data",
"tagDatabase": {
"tag": "v2.1.0"
},
"loadData": {
"dbms": "postgresql",
"columns": [
{
"column": {
"name": "id",
"type": "STRING"
}
},
{
"column": {
"name": "name",
"type": "STRING"
}
},
{
"column": {
"name": "state_id",
"type": "STRING"
}
},
{
"column": {
"name": "state_abbr",
"type": "STRING"
}
},
{
"column": {
"name": "state_name",
"type": "STRING"
}
},
{
"column": {
"name": "country_code",
"type": "STRING"
}
},
{
"column": {
"name": "country_name",
"type": "STRING"
}
},
{
"column": {
"name": "geom",
"type": "STRING"
}
}
],
"commentLineStartsWith": "//",
"encoding": "UTF-8",
"file": "../csv/0000-geom-data.csv",
"quoteChar": "\"",
"schemaName": "boundaries_justincollum",
"relativeToChangelogFile": true,
"separator": ",",
"tableName": "municipal_area",
"usePreparedStatements": true
}
},
The table looks like:
But when I run the migration I get an error:
"23-09-21 17:03:15] SEVERE [liquibase.integration] Migration failed for changeset changelog/changesets/000210_add_geoms.json::000210::jcollum:",
"son: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block",
"aused by: ERROR: column \"\"id\"\" of relation \"boundary_area\" does not exist",
"ition: 48",
In fact it can’t find any of the columns in the municipal_area
table. But when I select them it’s fine:
SELECT id FROM boundaries_justincollum.boundary_area ma LIMIT 10; -- returns 10 rows!
command line:
JAVA_OPTS=\"-Xms2048m -Xmx4096m\" liquibase update --url=jdbc:postgresql://[redacted]?currentSchema=boundaries_justincollum,public --default-schema-name=boundaries_justincollum --username=*** --password=*** --changelog-file=\"changelog/index.json\" --log-level=INFO"
It’s acting like it’s looking in the public schema – the table does not exist in the public schema. I built a very similar migration using sql files (we have about 20 existing migrations like that) and it worked fine. But as soon as I tried to use loadData
I started encountering issues.
Also the docs say quotchar but that’s not right it’s quotechar loadData – this makes me wonder if there are other issues in the docs.