Pyathena Utils API Specs

Methods

read_sql (file_path)

read sql file

read_sql

get_config_yaml (file_path)

get table schema config

get_config_yaml

format_sql_create_schema (sql, yaml_file_path)

create table sql from config schema

format_sql_create_schema

format_sql_repair_table (sql, table_name)

create repair table sql

format_sql_repair_table

read_sql

read_sql(file_path: str)
read sql file
Parameters:

filepath (str) – filepath of sql file

Returns:

sql query

Return type:

str

get_config_yaml

get_config_yaml(file_path: str)
get table schema config
Parameters:

filepath (str) – filepath; of sql file

Return table_name:

name of table

Return type:

str

Returns:

table_description; description of table

Return type:

str

Returns:

table_column_name; table column names

Return type:

str

Returns:

partition_column; name of partitioned column

Return type:

str

Returns:

partition_column_comment; description of partitioned column

Return type:

str

Returns:

s3_bucket name; of s3 bucket

Return type:

str

format_sql_create_schema

format_sql_create_schema(sql: str, yaml_file_path: str)
create table sql from config schema
Parameters:
  • sql (str) – sql query

  • yaml_file_path (str) – schema file path

Returns:

return_sql; final sql to create table

Return type:

str

Returns:

table_name; name of table

Return type:

str

format_sql_repair_table

format_sql_repair_table(sql: str, table_name: str)
create repair table sql
Parameters:
  • sql (str) – sql query

  • table_name (str) – name of table to repair

Returns:

repair sql

Return type:

str