[Python] Regular Expression not working as expected in Snowflake python connector

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

  1. Stack

    Stack Membro Participativo

    I have written a query which will filter out all the phone_no that is not of pattern (nnn)-nnn-nnnnn.

    select *
    from employee
    where not RLIKE(phone_no,'^\\(\\d{3}\\)-\\d{3}-\\d{4}$');


    It is giving the result as expected when I am query directly in Snowflake Console. But when i am using snowflake-connector-python to run the same query using pythonit is not working as expected.

    query="""
    INSERT into DEMO_DB.PUBLIC.EMPLOYEE_INTER_ATIF
    select * , 'Phone_No::Invalid Number'
    from DEMO_DB.PUBLIC.employee
    where NOT RLIKE(phone_no,'^\\(\\d{3}\\)-\\d{3}-\\d{4}$');
    """
    cs.execute(query).


    CS is the name of the cursor that I have made.

    What is the issue here.

    Continue reading...

Compartilhe esta Página