Skip to content

Commit 899c31e

Browse files
committed
Change string output of table definition to put parenthesis around a single partition key. Details in CASSANDRA-7274
1 parent 9947a67 commit 899c31e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

cassandra/metadata.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,8 @@ def as_cql_query(self, formatted=False):
718718
if len(self.partition_key) > 1 or self.clustering_key:
719719
ret += "%s%sPRIMARY KEY (" % (column_join, padding)
720720

721-
if len(self.partition_key) > 1:
722-
ret += "(%s)" % ", ".join(protect_name(col.name) for col in self.partition_key)
723-
else:
724-
ret += self.partition_key[0].name
721+
# Changed as part of CASSANDRA-7274
722+
ret += "(%s)" % ", ".join(protect_name(col.name) for col in self.partition_key)
725723

726724
if self.clustering_key:
727725
ret += ", %s" % ", ".join(protect_name(col.name) for col in self.clustering_key)

0 commit comments

Comments
 (0)