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-1882588 Allow Empty Sql Text when Dataframe Ast is Presented #2136

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/snowflake/connector/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,8 @@ def execute(

if _do_reset:
self.reset()
command = command.strip(" \t\n\r") if command else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change None to "", otherwise the following log formatters will fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense.

if not command:
command = command.strip(" \t\n\r") if command else ""
if not command and not _dataframe_ast:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we maybe clarify the logging logic here? If I understand this correctly, basically in the case of _dataframe_ast =True, command will be "". Should we log out the base64 string in debug mode? I.e.,

if not command:
   if _dataframe_ast:
         logger.debug("query[AST base64]: [%s]", _dataframe_ast)
   else:
         logger.warning("execute: no query is given to execute")
         return      

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Idea, let me change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

logger.warning("execute: no query is given to execute")
return None
logger.debug("query: [%s]", self._format_query_for_log(command))
Expand Down
Loading