By using AWS re:Post, you agree to the Terms of Use

Call a stored procedure in Redshift from Glue


Hi all,

I am trying to work out if it possible to call a stored procedure in redshift from a glue script. Appreciate any advice.

asked 3 years ago507 views
1 Answer
Accepted Answer

This should be very similar to running any SQL command on Redshift through python. You could use a python-shell job which connects to Redshift to run a stored procedure. A python sample which shows how to connect to the Redshift cluster from python using psycopg2 library:

def loadfile(filename):
  conn_string = "dbname='dbname' port='port' user='user' password='password' host=''"
  conn = psycopg2.connect(conn_string)
  cursor = conn.cursor()
  cursor.execute("INSERT INTO tb_table (field1) VALUES ('field1')")

There are details on some more forums

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions