예제 #1
0
    def test_as_cql_query(self):
        field_types = [
            IntegerType, AsciiType,
            TupleType.apply_parameters([IntegerType, AsciiType])
        ]
        udt = UserType("ks1", "mytype", ["a", "b", "c"], field_types)
        self.assertEqual(
            "CREATE TYPE ks1.mytype (a varint, b ascii, c frozen<tuple<varint, ascii>>);",
            udt.as_cql_query(formatted=False))

        self.assertEqual(
            """CREATE TYPE ks1.mytype (
    a varint,
    b ascii,
    c frozen<tuple<varint, ascii>>
);""", udt.as_cql_query(formatted=True))
예제 #2
0
    def test_as_cql_query(self):
        field_types = [IntegerType, AsciiType, TupleType.apply_parameters([IntegerType, AsciiType])]
        udt = UserType("ks1", "mytype", ["a", "b", "c"], field_types)
        self.assertEqual(
            "CREATE TYPE ks1.mytype (a varint, b ascii, c frozen<tuple<varint, ascii>>);",
            udt.as_cql_query(formatted=False),
        )

        self.assertEqual(
            """CREATE TYPE ks1.mytype (
    a varint,
    b ascii,
    c frozen<tuple<varint, ascii>>
);""",
            udt.as_cql_query(formatted=True),
        )
예제 #3
0
    def test_as_cql_query(self):
        field_types = ['varint', 'ascii', 'frozen<tuple<varint, ascii>>']
        udt = UserType("ks1", "mytype", ["a", "b", "c"], field_types)
        self.assertEqual(
            "CREATE TYPE ks1.mytype (a varint, b ascii, c frozen<tuple<varint, ascii>>)",
            udt.as_cql_query(formatted=False))

        self.assertEqual(
            """CREATE TYPE ks1.mytype (
    a varint,
    b ascii,
    c frozen<tuple<varint, ascii>>
);""", udt.export_as_string())
예제 #4
0
    def test_as_cql_query(self):
        field_types = ["varint", "ascii", "frozen<tuple<varint, ascii>>"]
        udt = UserType("ks1", "mytype", ["a", "b", "c"], field_types)
        self.assertEqual(
            "CREATE TYPE ks1.mytype (a varint, b ascii, c frozen<tuple<varint, ascii>>)",
            udt.as_cql_query(formatted=False),
        )

        self.assertEqual(
            """CREATE TYPE ks1.mytype (
    a varint,
    b ascii,
    c frozen<tuple<varint, ascii>>
);""",
            udt.export_as_string(),
        )
예제 #5
0
 def test_as_cql_query_name_escaping(self):
     udt = UserType("MyKeyspace", "MyType", ["AbA", "keyspace"], [AsciiType, AsciiType])
     self.assertEqual('CREATE TYPE "MyKeyspace"."MyType" ("AbA" ascii, "keyspace" ascii);', udt.as_cql_query(formatted=False))
예제 #6
0
 def test_as_cql_query_name_escaping(self):
     udt = UserType("MyKeyspace", "MyType", ["AbA", "keyspace"],
                    [AsciiType, AsciiType])
     self.assertEqual(
         'CREATE TYPE "MyKeyspace"."MyType" ("AbA" ascii, "keyspace" ascii);',
         udt.as_cql_query(formatted=False))