You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ee...@apache.org on 2011/03/23 22:17:33 UTC
svn commit: r1084747 - in /cassandra/trunk: drivers/py/cql/connection.py
test/system/test_cql.py
Author: eevans
Date: Wed Mar 23 21:17:32 2011
New Revision: 1084747
URL: http://svn.apache.org/viewvc?rev=1084747&view=rev
Log:
refresh schema information (Python CQL driver)
Patch by eevans for CASSANDRA-2260
Modified:
cassandra/trunk/drivers/py/cql/connection.py
cassandra/trunk/test/system/test_cql.py
Modified: cassandra/trunk/drivers/py/cql/connection.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/drivers/py/cql/connection.py?rev=1084747&r1=1084746&r2=1084747&view=diff
==============================================================================
--- cassandra/trunk/drivers/py/cql/connection.py (original)
+++ cassandra/trunk/drivers/py/cql/connection.py Wed Mar 23 21:17:32 2011
@@ -117,7 +117,12 @@ class Connection(object):
match = Connection._keyspace_re.match(prepared_query)
if match:
self._cur_keyspace = match.group(1)
-
+
+ # If this is a CREATE, then refresh the schema for decoding purposes.
+ if query.lstrip().upper().startswith("CREATE ", 0, 7):
+ if isinstance(self.decoder, SchemaDecoder):
+ self.decoder.schema = self.__get_schema()
+
return prepared_query
def execute(self, query, *args, **kwargs):
Modified: cassandra/trunk/test/system/test_cql.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1084747&r1=1084746&r2=1084747&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_cql.py (original)
+++ cassandra/trunk/test/system/test_cql.py Wed Mar 23 21:17:32 2011
@@ -465,7 +465,7 @@ class TestCql(ThriftTester):
r = conn.execute("""
SELECT '%s' FROM StandardTimeUUID WHERE KEY = 'uuidtest'
""" % str(timeuuid))
- assert r[0].columns[0].name == timeuuid.bytes
+ assert r[0].columns[0].name == timeuuid
# Tests a node-side conversion from long to UUID.
ms = uuid1bytes_to_millis(uuid.uuid1().bytes)
@@ -476,7 +476,7 @@ class TestCql(ThriftTester):
r = conn.execute("""
SELECT 'id' FROM StandardTimeUUIDValues WHERE KEY = 'uuidtest'
""")
- assert uuid1bytes_to_millis(r[0].columns[0].value) == ms
+ assert uuid1bytes_to_millis(r[0].columns[0].value.bytes) == ms
# Tests a node-side conversion from ISO8601 to UUID.
conn.execute("""
@@ -488,7 +488,7 @@ class TestCql(ThriftTester):
SELECT 'id2' FROM StandardTimeUUIDValues WHERE KEY = 'uuidtest'
""")
# 2011-01-31 17:00:00-0000 == 1296493200000ms
- ms = uuid1bytes_to_millis(r[0].columns[0].value)
+ ms = uuid1bytes_to_millis(r[0].columns[0].value.bytes)
assert ms == 1296493200000, \
"%d != 1296493200000 (2011-01-31 17:00:00-0000)" % ms
@@ -501,7 +501,7 @@ class TestCql(ThriftTester):
r = conn.execute("""
SELECT 'id3' FROM StandardTimeUUIDValues WHERE KEY = 'uuidtest'
""")
- ms = uuid1bytes_to_millis(r[0].columns[0].value)
+ ms = uuid1bytes_to_millis(r[0].columns[0].value.bytes)
assert ((time.time() * 1e3) - ms) < 100, \
"new timeuuid not within 100ms of now (UPDATE vs. SELECT)"