'Python Snowflake Connector Cursor returning Powershell Prompt VS Code

import snowflake.connector

sqltext = """SELECT *  FROM Some_table" 

conn = snowflake.connector.connect(
    account = "acct",
    user = "myusername",
    database = "db",
    schema = "my_schema",
    warehouse = "my_warehouse",
    role= "my_role",
    authenticator='externalbrowser'

print(conn.cursor().execute(sqltxt).fetchall())

This is causing VS Code to return a powershell prompt and is not returning any values.

Version: 1.65.2 (user setup) Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19044



Solution 1:[1]

print(conn.cursor().execute(sqltxt).fetchall()). It may caused by sqltext instead of sqltxt.

Solution 2:[2]

The reason VS code is opening a PS prompt is because it is not returning the error code when the above is run. In Pycharm, the error code is returned and the program exits.

The reason the error occurred was do to an incorrect installation of snowflake.connector package and dependencies.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MingJie-MSFT
Solution 2 meb33