Download pool/shard008/Python/0071416_cql_test.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/Python/0071416_cql_test.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard008/Python/0071416_cql_test.py
-
curl -L -o 0071416_cql_test.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/Python/0071416_cql_test.py
1.58 kB
| #!/usr/bin/env python | |
| # This program is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU Affero General Public License as published by | |
| # the Free Software Foundation; either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| # | |
| # See LICENSE for more details. | |
| # | |
| # Copyright (c) 2016 ScyllaDB | |
| import time | |
| from sdcm.tester import ClusterTester | |
| class CQLExampleTest(ClusterTester): | |
| """ | |
| Example test of how to establish CQL connections and run commands on them. | |
| """ | |
| def test_cql_example(self): | |
| """ | |
| Create a table, run a few sql statements | |
| """ | |
| node = self.db_cluster.nodes[0] | |
| with self.db_cluster.cql_connection_patient(node) as session: | |
| self.create_keyspace(keyspace_name='ks', replication_factor=1) | |
| # pylint: disable=no-member | |
| session.execute(""" | |
| CREATE TABLE test1 ( | |
| k int, | |
| c1 int, | |
| c2 int, | |
| v1 int, | |
| v2 int, | |
| PRIMARY KEY (k, c1, c2) | |
| ); | |
| """) | |
| time.sleep(1) | |
| session.execute("INSERT INTO test1 (k, c1, c2, v1, v2) " | |
| "VALUES (1, 2, 3, 4, 5)") | |
| res = session.execute("SELECT v1, v2 from test1") | |
| self.log.debug(res) | |