cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mish...@apache.org
Subject [08/10] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Fri, 21 Feb 2014 23:41:57 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0508a155
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0508a155
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0508a155

Branch: refs/heads/cassandra-2.1
Commit: 0508a155e5eec3ec89d02fa0b6a1dd05f86a4f82
Parents: 143372b 50e544f
Author: Mikhail Stepura <mishail@apache.org>
Authored: Fri Feb 21 15:39:59 2014 -0800
Committer: Mikhail Stepura <mishail@apache.org>
Committed: Fri Feb 21 15:39:59 2014 -0800

----------------------------------------------------------------------
 pylib/cqlshlib/cql3handling.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0508a155/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/cql3handling.py
index 093354a,5fe96bb..6c53717
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@@ -1235,31 -1170,3 +1236,31 @@@ class CqlTableDef
      def __str__(self):
          return '<%s %s.%s>' % (self.__class__.__name__, self.keyspace, self.name)
      __repr__ = __str__
 +
 +class UserTypesMeta(object):
 +    _meta = {}
 +
 +    def __init__(self, meta):
 +        self._meta = meta
 +
 +    @classmethod
 +    def from_layout(cls, layout):
 +        result = {}
 +        for row in layout:
 +            ksname = row[u'keyspace_name']
 +            if ksname not in result:
 +                result[ksname] = {}
 +            utname = row[u'type_name']
 +
 +            result[ksname][utname] = zip(row[u'column_names'], row[u'column_types'])
 +        return cls(meta=result)
 +
 +    def get_usertypes_names(self, keyspace):
 +        return map(str, self._meta.get(keyspace, {}).keys())
 +
 +    def get_field_names(self, keyspace, type):
 +        return [row[0] for row in self._meta.get(keyspace, {}).get(type, [])]
 +
 +    def get_fields_with_types(self, ksname, typename):
 +        return [(field[0], lookup_casstype(field[1]).cql_parameterized_type()) for field
in
-                 self._meta.get(ksname, {}).get(typename, [])]
++                self._meta.get(ksname, {}).get(typename, [])]


Mime
View raw message