Hi I followed this link (https://community.snowflake.com/s/article/How-to-include-query-results-in-Snowflake-email-alert-notifications) and now have a stored procedure on Snowflake that is converting a table into HTML and adding it to an alert email so people are aware of any failures / errors with any tasks / copy commands that we run into. The stored procedure bellow is working fine but am getting a table with no border lines:
CREATE OR REPLACE PROCEDURE ERRORS_ALERTS(
email_integration_name STRING,
email_address STRING
)
RETURNS STRING
LANGUAGE PYTHON
RUNTIME_VERSION = 3.10
PACKAGES = ('snowflake-snowpark-python', 'pandas', 'tabulate')
HANDLER = 'main'
AS $$
import snowflake.snowpark
import pandas
def main(
session: snowflake.snowpark.Session,
email_integration_name: str,
email_address: str
) -> str:
table_pandas_df: pandas.DataFrame = session.table("logs").to_pandas()
table_as_html: str = table_pandas_df.to_markdown(
tablefmt="html",
index=False
)
email_as_html: str = f"""
<p>Today's loading errors report</p>
<p>{table_as_html}</p>
"""
success: bool = session.call(
"SYSTEM$SEND_EMAIL",
email_integration_name,
email_address,
'Daily loading errors report',
email_as_html,
'text/html'
)
return "Email sent successfully" if success else "Sending email failed"
$$;
Whenever I run the stored procedure above I get an email with the table below in the body:
Any tips on how I can add some code to add border lines and enhance the formatting of this table?