question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Offline UpdateSQL for mariadb with csv doesn't handle boolean values correctly ?

See original GitHub issue

Environment

Liquibase Version: 4.11.0

Liquibase Integration & Version: maven

Liquibase Extension(s) & Version:

Database Vendor & Version: MariaDb

Operating System Type & Version:

Infrastructure Type/Provider:

Description

I use maven liquibase plugin to generate SQL from changeset for mariadb. A couple of changesets use loadUpdateData with csv data as input. The table I try to update contains boolean values, which are declared as 'bit' in mariadb. The CSV I have contains 'true' or 'false' value for values for these columns. When I generate the SQL in offline mode with mvn liquibase:updateSQL, I get insert statement with 'true' or 'false' values instead of 1 or 0.

I had a look at stackoverflow where they say that I should add a column element with valueBoolean="true", but it doesn’t change anything in the offline mode I’m in: I still get 'true' or 'false' values for bit column, which are incorrect values.

<loadData encoding="UTF-8"
          file="path/to/file.csv"
          separator=","
          tableName="MY_TABLE">
    <!-- specify that values in my_boolean_column should be interpreted as Boolean values -->
    <column name="my_boolean_column" type="BOOLEAN" />
</loadData>
<plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <configuration>
                    <changeLogFile>${liquibase.dir}/changelog-master.xml</changeLogFile>
                    <url>offline:mariadb?outputLiquibaseSql=true&amp;changeLogFile=${liquibase.offline.dir}/databasechangelog.csv</url>
                    <migrationSqlOutputFile>${liquibase.offline.dir}/upgrade-toto-${project.version}.sql</migrationSqlOutputFile>
                </configuration>
            </plugin>

Thank you for your help 😃

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
djeanprostcommented, Jun 22, 2022

After searching more and investigating, I found that this was not a bug but a problem between the keyboard and the chair. I did not mention the mapping column in the loadupdatedata with a correct type that should be in the list https://www.liquibase.org/javadoc/liquibase/change/core/LoadDataChange.LOAD_DATA_TYPE.html

0reactions
djeanprostcommented, Jun 17, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

The MariaDB CONNECT plugin Handler
Boolean True if the data file must not be modified or erased. ... Internally, date/time values are handled as a signed 4-bytes integer....
Read more >
2 Server Error Message Reference - MySQL :: Developer Zone
Occurs for failure to create or copy a file needed for some operation. Possible causes: Permissions problem for source file; destination file already...
Read more >
An Intermediate MySQL Tutorial - Scripting, Data Types ...
BOOLEAN (or BOOL): same as TINYINT(1) (with range of -128 to 127, display field-width of 1). Value of zero is considered false; non-zero...
Read more >
Important Upgrade Notes - Mattermost Documentation
Upgrading to Mattermost Server v7.1 Extended Support Release or later is ... string values to integers which is preventing Mattermost from working properly....
Read more >
Convert column data type | ThoughtSpot Software
Supported data type conversions · When you convert from INT to BOOL , zero is converted to false, and all non-zero values are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found