Skip to content

Instantly share code, notes, and snippets.

@64lines
Last active September 12, 2019 19:58
Show Gist options
  • Save 64lines/6bbc14bb0878c585719761b729998412 to your computer and use it in GitHub Desktop.
Save 64lines/6bbc14bb0878c585719761b729998412 to your computer and use it in GitHub Desktop.
from redshift_utils import Messages
from redshift_utils import ScriptReader
from redshift_utils import RedshiftDataManager
from settings import SCRIPT_PATH
from settings import DB_CONNECTION
def lambda_handler(event, context):
table_name = event.get('table_name')
new_table_name = event.get('new_table_name')
script = ScriptReader.get_script(SCRIPT_PATH).format(table_name, new_table_name)
return RedshiftDataManager.run_update(script, DB_CONNECTION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment