diff --git a/test/cqlpy/test_from_string.py b/test/cqlpy/test_from_string.py new file mode 100644 index 000000000000..0d9d72c073fc --- /dev/null +++ b/test/cqlpy/test_from_string.py @@ -0,0 +1,18 @@ +# Copyright 2024-present ScyllaDB +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +import pytest +from .util import unique_name + + +# Test that we can insert a vector from a string. +# This is marked as scylla-only because Apache Cassandra does not support +# such from_string syntax, but we want to have compatible string format +# in both our from_string and to_string functions. +# Please check abstract_type::to_string for reference. +def test_vector_from_string(cql, test_keyspace, scylla_only): + table = test_keyspace + "." + unique_name() + cql.execute(f"CREATE TABLE {table} (pk int primary key, v vector)") + cql.execute(f"INSERT INTO {table} (pk, v) VALUES (1, '1, 2, 3')") + assert cql.execute(f"SELECT v FROM {table} WHERE pk=1").one().v == [1, 2, 3]