Skip to main content

Utility package to AWS Athena and AWS Glue.

Project description

Lahap

Lahap is a utility package for AWS Athena and AWS Glue.

Code Style: Black

Usage

In order to run Lahap functions you must instantiate a Lahap session, a boto3.Session wrapper to manage boto3 calls. Use can provide any valid boto3.Session parameter to it.

from lahap import create_session

lahap = create_session(region_name="us-east-1", profile_name="profile") # using profile
lahap = create_session(region_name="us-east-1", aws_access_key_id="access-key", 
                       aws_secret_access_key="secret-key") # using explicit key credentials

Truncate table

Deletes all S3 files located in a Glue Table's S3 location. Be careful.

lahap.truncate_table(database="catalog-database", table="catalog-table")

Convert table to Parquet

Copies a table storing it as Parquet files through CTA. https://docs.aws.amazon.com/athena/latest/ug/create-table-as.html

lahap.convert_table_to_parquet(
    query_database="source-database",
    query_table="source-table",
    compression="Parquet Compression", # "UNCOMPRESSED", "SNAPPY", "LZO", "GZIP"
    result_database="result-database",
    result_table="result-table-parquet",
    external_location="s3://my-bucket/path",
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Lahap-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

Lahap-0.0.2-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page