harlequin-athena
This repo provides the Harlequin adapter for Amazon Athena.
Installation
harlequin-athena depends on harlequin, so installing this package will also install Harlequin.
Using pip
To install this adapter into an activated virtual environment:
pip install harlequin-athena
Using poetry
poetry add harlequin-athena
Using pipx
If you do not already have Harlequin installed:
pip install harlequin-athena
If you would like to add the Athena adapter to an existing Harlequin installation:
pipx inject harlequin harlequin-athena
As an Extra
Alternatively, you can install Harlequin with the athena extra:
pip install harlequin[athena]
poetry add harlequin[athena]
pipx install harlequin[athena]
Usage and Configuration
For a minimum connection you are going to need:
s3_staging_dir(required): S3 bucket path for query resultsregion(optional, default: us-east-1): AWS region
harlequin -a athena -s s3://my-bucket/athena-results/ -r us-east-1
Environment Variables
Adapter-specific options can be configured via environment variables. Environment variables are used as fallbacks when CLI options are not provided. The environment variable names follow the pattern HARLEQUIN_ATHENA_<OPTION_NAME> (uppercase with underscores):
HARLEQUIN_ATHENA_S3_STAGING_DIR: S3 staging directory (required)HARLEQUIN_ATHENA_WORK_GROUP: Athena work groupHARLEQUIN_ATHENA_SCHEMA: Default schema (database)HARLEQUIN_ATHENA_CATALOG: Catalog nameHARLEQUIN_ATHENA_POLL_INTERVAL: Polling interval in seconds
Note: AWS credentials and region can be configured using standard AWS SDK environment variables (automatically handled by boto3/pyathena):
AWS_ACCESS_KEY_ID: AWS access key IDAWS_SECRET_ACCESS_KEY: AWS secret access keyAWS_SESSION_TOKEN: AWS session token (for temporary credentials)AWS_REGIONorAWS_DEFAULT_REGION: AWS regionAWS_PROFILE: AWS profile name
Example using environment variables:
# Standard AWS SDK environment variables
export AWS_REGION="us-east-1"
export AWS_PROFILE="my-profile"
# Adapter-specific environment variables
export HARLEQUIN_ATHENA_S3_STAGING_DIR="s3://my-bucket/athena-results/"
export HARLEQUIN_ATHENA_WORK_GROUP="my-workgroup"
harlequin -a athena
AWS Credentials
The adapter supports multiple methods for AWS authentication:
-
Default credentials (environment variables, ~/.aws/credentials, or IAM role):
harlequin -a athena -s s3://my-bucket/athena-results/
-
AWS Profile:
harlequin -a athena -s s3://my-bucket/athena-results/ --profile my-profile
-
Explicit credentials:
harlequin -a athena -s s3://my-bucket/athena-results/ \ --aws-access-key-id AKIA... \ --aws-secret-access-key ...
Additional Options
--work-groupor-w: Athena work group to use--schemaor-dor--database: Default schema (database) to use--catalogor-c: Catalog name (default: AwsDataCatalog)--poll-interval: Polling interval in seconds for checking query status (default: 0.5, lower = faster polling)
Example with all options:
harlequin -a athena \
-s s3://my-bucket/athena-results/ \
-r us-east-1 \
-w my-workgroup \
-d my_database \
-c AwsDataCatalog
Many more options are available; to see the full list, run:
harlequin --help
For more information, see the Harlequin Docs.
Development
Setup
git clone https://github.com/yourusername/harlequin-athena.git
cd harlequin-athena
poetry install
Running Tests
poetry run pytest
Note: Tests require AWS credentials and an Athena setup. You may want to use mocking for CI/CD.
License
MIT
Metadata
Release files for harlequin-athena 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| harlequin_athena-0.1.2.tar.gz | 18.9 kB | Without provenance | Details for harlequin_athena-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| harlequin_athena-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for harlequin_athena-0.1.2-py3-none-any.whl |
Total release size: 38.4 kB
Release files / harlequin_athena-0.1.2.tar.gz
| Download URL | harlequin_athena-0.1.2.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6af30db9c5659b989b6d59141c48cac599287b9e2f90079f34f1b6998aa01208
|
|
BLAKE2b-256 checksum How to use checksums |
30e0ebbd2b99530a8e39945da55241a7c9e50507ae5085eb807a95836dd5ff02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / harlequin_athena-0.1.2-py3-none-any.whl
| Download URL | harlequin_athena-0.1.2-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2670f92ce402ae7a71d07c087835e5be8d309229f3cb39314aa6808a00e7c825
|
|
BLAKE2b-256 checksum How to use checksums |
885878b5d0031e3e33d8a79814293fe49fc31e9f977c95ee4d2c4564dfb50358
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for harlequin-athena 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.