update-count-sql
The update-count-sql
command is a helper command that inspects the SQL Liquibase will run while using the update-count command.
Uses
The update-count-sql
command is used to inspect the raw SQL before running the update-count
command, so you can correct any issues that may arise before running the command. Liquibase uses the raw SQL to apply a specified number of database changes you have added to the changelog file.
Running the update-count-sql
command
To run the update-count-sql
command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Specifying Properties in a Connection Profile. You can also specify properties from the command line.
Then run the update-count-sql
command:
liquibase --changelog-file=changelog.xml update-count-sql 2
Note: Enter the name of the changelog and the number that you want to use in place of changelog.xml
and 2
.
update-count-sql
global attributes
Tip: All commands and parameters use the --kebab-case
format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.
Attribute |
Definition |
Requirement |
|
Specifies the root changelog |
Required |
|
Specifies the JDBC database connection URL |
Required |
|
Specifies the database username |
Required |
|
Specifies the database password |
Required |
|
Specifies the file path to where the |
Optional |
*Liquibase checks the changelog and any nested changelogs for the definitions of the changeset to update.
** If not specified, the update-count-sql
output goes to STDOUT
.
Note: The username
and password
attributes are not required for connections and systems which use alternate means of authentication.
update-count-sql
command attributes
Attribute | Definition | Requirement |
---|---|---|
|
The integer indicating the number of changes you want to update |
Required |

Liquibase Version: 4.9.1
Liquibase Community 4.9.1 by Liquibase
-- *********************************************************************
-- Update 2 Change Sets Database Script
-- *********************************************************************
-- Change Log: example-changelog.sql
-- Ran at: 5/9/22, 10:37 AM
-- Against: DBUSER@jdbc:h2:tcp://localhost:9090/mem:dev
-- Liquibase version: 4.9.1
-- *********************************************************************
-- Lock Database
UPDATE PUBLIC.DATABASECHANGELOGLOCK SET LOCKED = TRUE, LOCKEDBY = 'DESKTOP-SQVSSV2 (192.168.1.179)', LOCKGRANTED = NOW() WHERE ID = 1 AND LOCKED = FALSE;
-- Release Database Lock
UPDATE PUBLIC.DATABASECHANGELOGLOCK SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;
Liquibase command 'update-count-sql' was executed successfully.