[Python] How can I convert python dictionary to a json object with loggers in snowflake event...

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    I have a snowflake event table created. The below code inserts log records into event table.

    import snowflake.snowpark as snowpark
    import logging
    def main(session: snowpark.Session):
    LOGGER = logging.getLogger('snowflake.snowpark.session')
    dict1 = {"abc": "123", "cdf": "345"}

    LOGGER.info(dict1)
    return f'Testing the Logging'


    Now this dict is being written as string in snowflake event table under 'VALUE' column which is VARIATNT. "{'abc': '123', 'cdf': '345}" How can make this as json object instead of string using the above loggers

    Tried different ways but nothing helped

    Continue reading...

Compartilhe esta Página