partiql
partiql
is a Change Type in the Liquibase DynamoDB Pro extension that allows you to specify some PartiQL statements in your changesets. In DynamoDB changesets, use partiql
instead of sql
. For more information, see PartiQL - a SQL-compatible query language for Amazon DynamoDB.
Uses
partiql
is useful for complex changes that are not supported through Liquibase automated Change Types such as stored procedures. The PartiQL contained in partiql
can be multi-line.
Run partiql
To run this Change Type, follow these steps:
- Add the Change Type to your changeset, as shown in the examples on this page.
- Specify any required attributes. Use the table on this page to see which ones your database requires.
- Deploy your changeset by running the
update
command:
liquibase update
Now, Liquibase deploys your change on your DynamoDB database. By default, read operations on DynamoDB are eventually consistent. When you look at your database immediately after running liquibase update
, DynamoDB may display the status of an object as CREATING
, UPDATING
, or DELETING
. When it finishes, it displays the status as ACTIVE
.
Note: If your deployment fails because the DynamoDB waiter times out or reaches a retry limit, you can modify the waiter settings using Liquibase Parameters for Amazon DynamoDB Pro.
Available attributes
Name | Type | Description | Requirement |
---|---|---|---|
partiql
|
String | Specifies the PartiQL to execute. | Required |
dbms
|
String |
Specifies which database type Note: Liquibase currently only supports PartiQL on DynamoDB. If you use PartiQL on other databases, your changes may result in unexpected behavior. |
Optional |
endDelimiter
|
String |
Specifies delimiter to apply to the end of the statement. Your delimiter string can be a combination of one or more letters, symbols, and/or numbers, or the empty string ( Tip: It is a best practice not to use |
Optional |
splitStatements
|
Boolean |
If Tip: It is a best practice not to use |
Optional |
stripComments
|
Boolean |
When |
Optional |
Examples
databaseChangeLog:
- changeSet:
id: 2
author: your.name
comment: partiql with splitStatements and endDelimiter test
changes:
- partiql:
splitStatements: true
endDelimiter: "@@"
partiql: "INSERT INTO MusicPartiqlTestYAML value {'Artist' : '3 Doors Down','SongTitle' : 'Kryptonite'}@@ INSERT INTO MusicPartiqlTestYAML value {'Artist' : 'Mike Oldfield','SongTitle' : 'Man in the Rain'}"
- rollback:
partiql:
splitStatements: true
endDelimiter: "@@"
partiql: "DELETE FROM MusicPartiqlTestYAML WHERE Artist='3 Doors Down' AND SongTitle='Kryptonite'@@ DELETE FROM MusicPartiqlTestYAML WHERE Artist='Mike Oldfield' AND SongTitle='Man in the Rain'"
{
"databaseChangeLog": [
{
"changeSet": {
"id": "2",
"author": "your.name",
"comment": "partiql with splitStatements and endDelimiter test",
"changes": [
{
"partiql": {
"partiql": "INSERT INTO MusicPartiqlTestJson value {'Artist' : '3 Doors Down','SongTitle' : 'Kryptonite'}@@ INSERT INTO MusicPartiqlTestJson value {'Artist' : 'Mike Oldfield','SongTitle' : 'Man in the Rain'}",
"splitStatements": true,
"endDelimiter": "@@"
}
}
],
"rollback": [
{
"partiql": {
"partiql": "DELETE FROM MusicPartiqlTestJson WHERE Artist='3 Doors Down' AND SongTitle='Kryptonite'@@ DELETE FROM MusicPartiqlTestJson WHERE Artist='Mike Oldfield' AND SongTitle='Man in the Rain'",
"splitStatements": true,
"endDelimiter": "@@"
}
}
]
}
}
]
}
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dynamodb="http://www.liquibase.org/xml/ns/pro-dynamodb"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/pro-dynamodb
http://www.liquibase.org/xml/ns/pro-dynamodb/liquibase-pro-dynamodb-latest.xsd
http://www.liquibase.org/xml/ns/pro
http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
<changeSet id="2" author="your.name">
<comment>partiql with splitStatements and endDelimiter test</comment>
<dynamodb-pro:partiql splitStatements="true" endDelimiter="@@">
INSERT INTO MusicPartiqlTestXML value {'Artist' : '3 Doors Down','SongTitle' : 'Kryptonite'}@@ INSERT INTO MusicPartiqlTestXML value {'Artist' : 'Mike Oldfield','SongTitle' : 'Man in the Rain'}
</dynamodb-pro:partiql>
<rollback>
<dynamodb-pro:partiql splitStatements="true" endDelimiter="@@">
DELETE FROM MusicPartiqlTestXML WHERE Artist='3 Doors Down' AND SongTitle='Kryptonite'@@ DELETE FROM MusicPartiqlTestXML WHERE Artist='Mike Oldfield' AND SongTitle='Man in the Rain'
</dynamodb-pro:partiql>
</rollback>
</changeSet>
</databaseChangeLog>
Database support
This Change Type is only supported for Amazon DynamoDB. It does not support auto rollback.