Utility package to AWS Athena and AWS Glue.
Project description
Lahap
Lahap is a utility package for AWS Athena and AWS Glue.
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")
Drop table
Drops Glue Table with or without its respective data in S3. Be careful.
lahap.drop_table(database="catalog-database", table="catalog-table", only_schema=False)
Convert table to Parquet
Copies a table storing it as Parquet files through CTA.
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",
)
Convert query to Parquet
Create a new table from query and storing it as Parquet files through CTA.
lahap.convert_query_to_parquet(
query="SELECT * FROM database.table",
compression="parquet-compression", # "UNCOMPRESSED", "SNAPPY", "LZO", "GZIP"
result_database="result-database",
result_table="result-table-parquet",
external_location="s3://my-bucket/path",
)
References
Amazon Athena CTA
https://docs.aws.amazon.com/athena/latest/ug/create-table-as.html
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Lahap-0.2.1.tar.gz.
File metadata
- Download URL: Lahap-0.2.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f221317bdee3990262ea099e153d451a0129798e63d87c73e847433bcc54787
|
|
| MD5 |
143c2701da7ccd3623279eca01036391
|
|
| BLAKE2b-256 |
a956766387387907e37021cdb8017266c91eefa013c3d7540f431f56603b4c6c
|
File details
Details for the file Lahap-0.2.1-py3-none-any.whl.
File metadata
- Download URL: Lahap-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.8.0 tqdm/4.36.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a78c5ca878a7917d99aba456e0aa7a57ea99b8f7a38e6c97880701f51c1062ef
|
|
| MD5 |
d280df7491ed802a1a1ab6b33b412ed2
|
|
| BLAKE2b-256 |
111c22086b51ded1810e8bf18377c276c062a7f8b6444689ee8f11af7d4dbed2
|