Skip to content

Commit

Permalink
Add support for COPY TO special CQL command
Browse files Browse the repository at this point in the history
  • Loading branch information
maximevw committed Jan 1, 2025
1 parent 155be2f commit 4535551
Show file tree
Hide file tree
Showing 12 changed files with 614 additions and 49 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- Add support for the special CQL command `SOURCE <filename>` in `CassandraStatement`.
- Add support for the following special CQL commands in `CassandraStatement`:
- `SOURCE <filename>`
- `COPY <tableName>[(<colums>)] TO <target>[ WITH <options>[ AND <options>...]]`
- Add a method `CassandraConnection.setOptionSet(OptionSet)` to programmatically define a custom compliance mode option
set on a pre-existing connection.

Expand Down
5 changes: 5 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ Copyright 2009 Google
This product includes software developed as part of the JSR305 Annotations for Findbugs project
( https://code.google.com/archive/p/jsr-305/ ).

OpenCSV
Copyright 2005 Bytecode Pty Ltd.
This product includes software developed as part of the OpenCSV project
( https://opencsv.sourceforge.net/ ).

Semver4j
Copyright 2022-present Semver4j contributors
This product includes software developed as part of the Semver4j project
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Connect to a Cassandra cluster using the following arguments:
* JDBC driver class: `com.ing.data.cassandra.jdbc.CassandraDriver`
* JDBC URL: `jdbc:cassandra://host1--host2--host3:9042/keyspace?localdatacenter=DC1`

You can give the driver any number of hosts you want separated by "--". You can optionally specify a port for each host.
You can give the driver any number of hosts you want separated by `--`. You can optionally specify a port for each host.
If only one port is specified after all the listed hosts, it applies to all hosts. If no port is specified at all, the
default Cassandra port (9042) is used.
They will be used as contact points for the driver to discover the entire cluster.
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<java.driver.version>4.18.1</java.driver.version>
<jackson.version>2.18.2</jackson.version>
<javax-jsr305.version>3.0.2</javax-jsr305.version>
<opencsv.version>5.9</opencsv.version>
<semver4j.version>5.4.1</semver4j.version>
<!-- Versions for test dependencies -->
<approvaltests.version>24.12.0</approvaltests.version>
Expand Down Expand Up @@ -254,6 +255,13 @@
<version>${aws-secretsmanager.version}</version>
</dependency>

<!-- OpenCSV for implementation of COPY special command -->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>${opencsv.version}</version>
</dependency>

<!-- Unit tests libraries -->
<dependency>
<groupId>org.mockito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public ResultSet executeQuery(final String cql) throws SQLException {
*
* @param cql A CQL Data Manipulation Language (DML) statement, such as {@code INSERT}, {@code UPDATE}, or
* {@code DELETE}; or a CQL statement that returns nothing, such as a DDL statement.
* @return Always 0, for any statement. The rationale is that Datastax Java driver does not provide update count.
* @return Always 0, for any statement. The rationale is that DataStax Java driver does not provide update count.
* @throws SQLException when something went wrong during the execution of the statement.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
* connection to the given value, otherwise return a result set with a single row containing the
* current consistency level in a column {@code consistency_level}.
* </p>
* <p>
* The documentation of the original {@code CONSISTENCY} command is available:
* <ul>
* <li><a href="https://cassandra.apache.org/doc/latest/cassandra/managing/tools/cqlsh.html#consistency">
* in the Apache Cassandra® documentation</a></li>
* <li><a href="https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlshConsistency.html">
* in the DataStax CQL reference documentation</a></li>
* </ul>
* </p>
*/
public class ConsistencyLevelExecutor implements SpecialCommandExecutor {

Expand Down
Loading

0 comments on commit 4535551

Please sign in to comment.