[ https://issues.apache.org/jira/browse/CASSANDRA-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Blake Visin updated CASSANDRA-2939: ----------------------------------- Description: In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py) {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M){code} The Regex will improperly match anything after the word 'from' even if it is in the WHERE clause I believe the fix is: {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M){code} Added the ? so the regex is not so greedy use this query to reproduce the results: SELECT key FROM column_family WHERE key = 'break from chores'" was: In the file cursor.py (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py) Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", re.I | re.M) The Regex will improperly match anything after the word 'from' even if it is in the WHERE clause I believe the fix is: _cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | re.M) Added the ? so the regex is not so greedy use this query to reproduce the results: SELECT key FROM column_family WHERE key = 'break from chores'" > CQL regex to match column family in query > ----------------------------------------- > > Key: CASSANDRA-2939 > URL: https://issues.apache.org/jira/browse/CASSANDRA-2939 > Project: Cassandra > Issue Type: Bug > Components: Drivers > Environment: Python CQL > Reporter: Blake Visin > Labels: CQL, python > > In the file cursor.py > (https://svn.apache.org/repos/asf/cassandra/drivers/py/cql/cursor.py) > {code}Line 37: _cfamily_re = re.compile("\s*SELECT\s+.+\s+FROM\s+[\']?(\w+)", > re.I | re.M){code} > The Regex will improperly match anything after the word 'from' even if it is > in the WHERE clause > I believe the fix is: > {code}_cfamily_re = re.compile("\s*SELECT\s+.+?\s+FROM\s+[\']?(\w+)", re.I | > re.M){code} > Added the ? so the regex is not so greedy > use this query to reproduce the results: > SELECT key FROM column_family WHERE key = 'break from chores'" -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira