Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1342891: Are CTEs allowed while doing session.sql()? #1931

Closed
arghhjayy opened this issue Apr 23, 2024 · 1 comment
Closed

SNOW-1342891: Are CTEs allowed while doing session.sql()? #1931

arghhjayy opened this issue Apr 23, 2024 · 1 comment
Assignees
Labels
status-triage_done Initial triage done, will be further handled by the driver team

Comments

@arghhjayy
Copy link

arghhjayy commented Apr 23, 2024

Python version

3.11.4

Operating system and processor architecture

Windows-10-10.0.17763-SP0

Installed packages

The list is too long and is in a VM so copying is difficult. I don't think it will be needed. If needed, I'll post here.

What did you do?

I'm trying to execute a SQL using a Snowflake Python Connector session. Something like:

from snowflake.snowpark import Session

session = Session.builder.configs(SnowflakeLoginOptions()).getOrCreate()

with open('path/to/file.sql', 'r', encoding='utf-8') as f:
    df = session.sql(f.read()).collect()

where file.sql has SQL starting with a CTE, something like this:

WITH CTE AS (
..

..
)
SELECT * FROM CTE

What did you expect to see?

I expected the SQL statement to be run successfully and the data should be returned as snowflake.snowpark.DataFrame

Instead, I'm getting this:

image

I have a question: are CTEs not allowed in Snowflake Python Sessions or am I missing anything

@github-actions github-actions bot changed the title Are CTEs allowed while doing session.sql()? SNOW-1342891: Are CTEs allowed while doing session.sql()? Apr 23, 2024
@sfc-gh-sghosh sfc-gh-sghosh self-assigned this Apr 23, 2024
@arghhjayy
Copy link
Author

Nvm, it was an encoding error with the SQL file. Turns out it started with a special, invisible character which was causing the failure.

@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team and removed bug needs triage labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

2 participants