Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BUCKET = os.getenv('BUCKET', 'bucket')
- def init_schema(event, context):
- db = get_results(f"""
- CREATE DATABASE IF NOT EXISTS mydb
- LOCATION 's3://{BUCKET}/';
- """)
- table = get_results(f"""
- CREATE EXTERNAL TABLE IF NOT exists users (
- id STRING,
- first_name STRING,
- last_name STRING,
- birthday STRING
- )
- ROW FORMAT serde 'org.openx.data.jsonserde.JsonSerDe'
- with serdeproperties ( 'paths'='id, first_name, last_name, birthday' )
- LOCATION 's3://{BUCKET}/';
- """)
- return db, table
Add Comment
Please, Sign In to add comment