Created
July 22, 2020 07:30
-
-
Save arihantsurana/2361c435355ab0131636949428ce4fc4 to your computer and use it in GitHub Desktop.
And example use of writing SQL to generate performant Athena tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hip_data_tools.etl.athena_to_athena import AthenaToAthena, AthenaToAthenaSettings | |
from hip_data_tools.aws.common import AwsConnectionSettings | |
aws_conn = AwsConnectionSettings( | |
region="ap-southeast-2", | |
secrets_manager=None, | |
profile="default") # to access the default aws profile on your machine | |
etl = AthenaToAthena( | |
settings=AthenaToAthenaSettings( | |
source_sql="SELECT 'abc' as abc", | |
source_database="test", | |
target_database="test", | |
target_table="test_table", | |
target_data_format="PARQUET", | |
target_s3_bucket="test_bucket", | |
target_s3_dir="test_dir", | |
target_partition_columns=["abc"], | |
connection_settings=aws_conn | |
) | |
) | |
sql = etl.generate_create_table_statement() | |
print(sql) | |
etl.execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment