Use Liquibase Flow files with Azure Blob Storage
Liquibase Flow files let you define multi-step operations in a single YAML file, making it easier to automate and manage tasks, such as generating snapshots and diffs. With the Liquibase Azure extension, you can store output files from these operations directly in Azure Blob Storage using the az://
path format.
This guide shows you how to create and customize a Flow file, and run it to generate a snapshot file in Azure Blob Storage. You can use the same pattern to configure other commands like diff
or updateSQL
.
1. Create a sample Flow file
Be sure you are in a directory where you'd like to create your Flow file, run the following command in the CLI, and select option 3 when prompted:
liquibase flow
A Flow file will be created in the current directory.
2. Edit the Flow file
Open the created liquibase.flowfile.yaml
file and replace its contents with the following example code.
Before you run the example code, be sure to:
- Update your_blob_container with the name of your blob storage container in Azure where you would like to upload the file.
- Replace test-snapshot.json with your preferred output file name, if desired.
Example Code
globalVariables:
ENV: DEV
stages:
Snapshot:
actions:
- type: liquibase
command: snapshot
cmdArgs:
{ snapshot-format: json }
globalArgs:
{ output-file: 'az://your_blob_container/test-snapshot.json' }
Note: The output-file
path uses the Azure Blob Storage az:// format and points to the container where the snapshot will be stored.
3. Run the Flow file
Run the flow file using the command example code.
Be sure to set your_flowfile_path
to the file path to your flow file.
liquibase flow --flowfile=your_flowfile_path
4. Confirm the snapshot was uploaded in Azure
1. Go to the Azure Portal.
2. Navigate to your Storage Account.
3. Go to Data Storage > Containers, then open your target container.
4. Verify that your snapshot file appears in the container.