alvsanand / liquibase-athena

Liquibase support for AWS Athena

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liquibase Athena Extension

This is a Liquibase extension for connecting to an Amazon Athena database.

Amazon Athena is an interactive query service that analyzes data directly in Amazon Simple Storage Service (Amazon S3) using standard SQL.


NOTE

Athena extension uses Iceberg tables to manage Liquibase Tracking Tables.


Configuring the extension

These instructions will help you get the extension up and running on your local machine for development and testing purposes. This extension has a prerequisite of Liquibase core in order to use it. Liquibase core can be found at https://www.liquibase.org/download

Pre-requisites

The following dependencies have to be available before using it:

Liquibase CLI

Download the latest released Liquibase extension .jar file and place it in the liquibase/lib install directory. If you want to use another location, specify the extension .jar and athena-jdbc-*.jar file in the classpath of your liquibase.properties file.

Maven

First, add Github repository authentication to your pom.xml or settings.xml+:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
    ...
    <servers>
      ...
        <server>
            <id>github</id>
            <username>{GITHUB_TOKEN}</username>
            <password>{GITHUB_TOKEN}</password>
        </server>
        ...
    </servers>
    ...
</settings>

Specify the Liquibase extension in the <dependency> section of pom.xml by adding the org.liquibase.ext dependency for the Liquibase plugin.

...
   <repositories>
      ...
      <repository>
         <id>github</id>
         <url>https://maven.pkg.github.com/alvsanand/liquibase-athena</url>
         <snapshots>
               <enabled>true</enabled>
         </snapshots>
      </repository>
      ...
   </repositories>
...
<plugins>
   ...
   <plugin>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-maven-plugin</artifactId>
      <version>4.3.2</version>
      <configuration>
         <propertyFile>liquibase.properties</propertyFile>
      </configuration>
      <dependencies>
         <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-athena</artifactId>
            <version>${liquibase-athena.version}</version>
         </dependency>
      </dependencies>
   </plugin>
...
</plugins>
...

Extension Properties

Liquibase Athena extension needs to be configured to work so you must add the following properties:

# The S3 path where to store Liquibase tables.
liquibase.athena.liquibaseTableS3Location=s3://some_bucket/some_path

Java call

public class Application {
    public static void main(String[] args) {
        AthenaDatabase database = (AthenaDatabase) DatabaseFactory.getInstance().openDatabase(url, null, null, null, null);
        Liquibase liquibase = new Liquibase("liquibase/ext/changelog.generic.test.xml", new ClassLoaderResourceAccessor(), database);
        liquibase.update("");
    }
}

Issue Tracking

Any issues can be logged in the Github issue tracker.

License

This project is licensed under the Apache License Version 2.0.

About

Liquibase support for AWS Athena

License:Apache License 2.0


Languages

Language:Java 100.0%