Native Executors
Liquibase primarily uses JDBC drivers to connect and deploy changesets to a database. However, there are instances when the JDBC driver is insufficient to process highly specialized SQL.
Using native executors with Liquibase Pro can provide distinct advantages, such as the ability to process database client-specific settings and environment variables within the SQL script.
Note: Liquibase Pro always uses the JDBC driver for certain commands and administrative tasks.
Compatible Native Executors
Four native executors can be used with Liquibase Pro:
- Oracle: use the
sqlplus
native executor. - Microsoft SQL Server: use the
sqlcmd
native executor. - PostgreSQL: use the
psql
native executor. - MongoDB Pro: use the
mongosh
native executor.
Database native executors are not shipped with Liquibase. Users need to install the compatible native executor specific to their database type.
Using Native Executors
Liquibase Pro extends the ability to deploy changesets using native database clients so during execution time, a native executor is invoked for changesets that request it to deploy a payload to a target database.
Note: Liquibase can deploy a SQL payload using a JDBC driver or a native executor.
The runWith
attribute
Liquibase decides whether to use the native executor based on the presence of the runWith
attribute. You must apply this attribute to each changeset you want to deploy using a native executor:
- In Formatted SQL changelogs, you can apply
runWith
to any changeset. - In XML, YAML, and JSON changelogs, you can only apply
runWith
to changesets using thesql
andsqlFile
Change Types.
runWith
is applied during update
and rollback
operations. When runWith
is not present, Liquibase uses the JDBC driver to deploy the changeset.
To learn more about using the runWith
attribute with native executors, refer to the database-specific native executor page linked in Compatible Native Executors.
Related Links
For more information on the sql
and sqlFile
Change Type, visit the following documentation pages:
Liquibase Resources
Liquibase Help
Visit the Liquibase Forum to ask questions, find answers from other Liquibase users, and learn about new Liquibase version releases.