For anyone looking to query a Postgres database table and send the output in a nice tabular format to slack.
Postgres DB Connection module
def dbConnect (db_parm, username_parm, host_parm, pw_parm):
    # Parse in connection information
    credentials = {'host': host_parm, 'database': db_parm, 'user': username_parm, 'password': pw_parm}
    conn = psycopg2.connect(**credentials)
    conn.autocommit = True  # auto-commit each entry to the database
    conn.cursor_factory = RealDictCursor
    cur = conn.cursor()
    print ("Connected Successfully to DB: " + str(db_parm) + "@" + str(host_parm))
    return conn, cur
Slack Broadcast to Channel module
def slackBot(self, message):
    webhook_url = self.slack_incoming_webhook
    slack_data = {"text":"``` " + str(message) + " ``` <!here>"}
    header = {'Content-Type': 'application/json'}
    response = requests.post(webhook_url, json=slack_data,headers=header)
    if response.status_code != 200:
        raise ValueError(
            'Request to slack returned an error %s, the response is:\n%s'
            % (response.status_code, response.text)
          )
Prepare Slack Message module
def prepareSlackMessage(self, cur):
        from tabulate import tabulate
        query         = "SELECT something_awesome FROM my_awesome_table"
        print query
        out         = dbQuery(cur, query)
        if len(out) > 0:
            df = pd.DataFrame(data=list(out), index=None, dtype=object)
            df_tab  = tabulate([list(row) for row in df.values], headers=list(df.columns), tablefmt="grid", stralign="center")
            print df_tab
        else:
            df_tab = "Nothing to post, the database query didnt return any result"
            print df_tab
        return df_tab
Sample output message in Slack