I’m trying to add a Python logger to my Snowpark Python stored procedure.
The documentation says that I must create an Event Table, and that Event Tables must be associated with an account, and that an account can be associated with only one event table at a time.
You associate an event table with your account in order to capture log entries and trace events to that table. You can associate an account with only one event table at a time. The associated event table is referred to as the active event table.
- Link
I’m working on a company Snowflake account, and I do not have admin rights.
To enable storage of log and trace event data from functions and procedures for an account, you must specify that the event table you created is the active event table for the account.
- Link
This seems to imply that as an individual developer with a restricted account, I cannot use a Python logger to log activity from my stored procedure.
I’m currently working around this by creating my own logs by constructing SQL statements and inserting into a normal table (not an event table).
But if possible I’m wondering if there’s a way to still use a Python logging handler without having to send it to an event table. Or if I can construct an event table associated with one or more stored procedure logs, rather than all the logs of a particular account.
Any insight from someone familiar with Snowpark Python is much appreciated.
I tried creating an event table:
CREATE EVENT TABLE my_database.my_schema.my_events;
and then adding a test logger to my stored procedure to see if any information would be sent to that event table:
import logging
logger = logging.getLogger("mylog")
def test_logging(self):
logger.info("This is an INFO test.")
But when I successfully created and called my stored procedure, no new rows were added to the event table.
Likely this is because I am unable to associate the event table with my account.
But this is the only code test I’ve tried so far.
Giordano Rogers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.