-
Notifications
You must be signed in to change notification settings - Fork 198
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
[BUG]SQL Execution Canceled During INSERT Operation in Snowflake #1716
Comments
Hey @HannaHUp - are you using SQL to call Snowflake Cortex in your app? That may be the cause here. Can you change it to use the python API? |
Thank you for your response! I believe I am already using the Python API to interact with Snowflake. Specifically, I am using the SnowflakeConnector class from trulens.connectors.snowflake `
` |
can you share your app code? |
trulens_sf.zip |
#1717 |
Looking at your code, feel like I'm missing where your app is actually defined. Is there additional code where you set up |
trulens_sf.zip |
One possible issue here is that the output of This is because I'd recommend switching the order of the method output so that generated_message is always the first value returned in the Tuple. So in L100, change |
Hi, We’ll also modify the order of the method output. |
Good to know. Let me know if changing the order of the method output helps or if you're still seeing issues - thanks! |
Hey @HannaHUp - we discovered some incompatibility with snowflake-sqlalchemy v1.7.2 that may also be causing this issue. Can you test with snowflake-sqlalchemy==1.7.1 or earlier? Thanks! |
@sfc-gh-jreini |
Bug Description
What happened?
An unexpected error occurs while attempting to execute an INSERT operation in Snowflake using snowflake-connector. The transaction is canceled with a ProgrammingError, citing that the transaction is being committed, and SQL execution is canceled.
To Reproduce
Which steps should someone take to run into the same error? A small, reproducible code example is useful here.
Unfortunately, I cannot reliably reproduce the error myself as it happens intermittently. However, it occurs quite often during execution.
Expected behavior
A clear and concise description of what you expected to happen.
The data should be successfully saved into Snowflake without any errors.
Relevant Logs/Tracebacks
Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. If the issue is related to the TruLens dashboard, please also include a screenshot.
`un unexpected error occurred: (snowflake.connector.errors.ProgrammingError) 000614 (57014): 01b99a49-0512-a1e0-0074-820306b2185a: Transaction '5c518634-c4c0-471c-8d8a-bd20b4dd453e', id '1736452409002000000', was committed, SQL execution canceled.
[SQL: INSERT INTO trulens_records (record_id, app_id, input, output, record_json, tags, ts, cost_json, perf_json) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]
(Background on this error at: https://sqlalche.me/e/20/f405)`
Environment:
Additional context
Add any other context about the problem here.
`def initialize_sessions(sf_settings: dict, password: str) -> Tuple[Session, TruSession]:
"""
Initialize Snowpark session and TruLens session.
"""
sf_config = sf_settings.copy()
sf_config.update({
"connection_timeout": 300, # 5 minutes
"client_session_keep_alive": True,
"session_timeout": 600 # 10 minutes
})
with tru_app:
response = retrieval_app.ask_question(
query=qa.get("question"),
)
print(f"Response: {response}")
`
The text was updated successfully, but these errors were encountered: