snowflakedb / snowflakedb/snowflake-connector-python

SNOW-3379021: Mistaken regex in cursor.py

Open
#2,853 4 comments 0 reactions 1 assignee View on GitHub

@sfc-gh-snow-drivers-warsaw-dl is already working on this.

Since Apr 17, 2026.

status-triage_done
Dominant language
Python
Stars
730
Forks
574
Avg merge
5h 45m
Merged PRs (30d)
16

Description

Python version

All versions

Operating system and processor architecture

All operating systems and processor architectures

Installed packages
N/A
What did you do?
N/A
What did you expect to see?

Both snowflake.connector.cursor and snowflake.connector.aio._cursor have a check like this:

            if re.search(";/s*$", command) is None:
                command = command + "; "

The /s should probably be \s. As-is, this sticks in an extra ;

In [14]: command = 'SELECT * FROM data; '
    ...: if re.search(";/s*$", command) is None:
    ...:                 command = command + "; "
    ...: print(command)
SELECT * FROM data; ;

Contrast with this:

In [15]: command = 'SELECT * FROM data; '
    ...: if re.search(r";\s*$", command) is None:
    ...:                 command = command + "; "
    ...: print(command)
SELECT * FROM data;

Alternatively, this would do the same trick without re:

            if not command.rstrip().endswith(";"):
                command = command + "; "

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.