Inserting data in cassandra without puting in single quotes using cql java driver -
I have trouble troubleshooting those single quotes for ASCII / timestamp columns and other types like int, decimals, Boolean etc. is not putting.
The data comes from another DB / table, which is a SQL.
I have all the column data as strings. I do not want to format every column data to check empty values and then decide to keep the quote.
Whether using ready statement, it is possible to prepare the inserted data in value or whatever
If you do not want to write a loader who uses a ready statement (via the CQL driver .. which is a good idea), I can think of another method. To import without using single quotation marks, you should be able to complete it with the See the Edit: I also read the above question and assume that you did not want a prepared statement-based answer. Since this is not a clear matter, I thought I would provide a data here (using the JavaCLL driver of Datacax). Note that this answer is based on my column family and column names above my example, and assumes that For this solution, you do not need to finish your string data in a single quote, and there are some additional benefits on your string. ReplaceAll: For more information, check out. COPY FROM CQL3 command (Setting the
QUOTE parameter for an empty string) needed. If you can dump your RDBMS data into a CSV file, then you should be able to insert those values in the cassandra in such a way:
COPY myColumnFamily (colname1, colname2, colname3 ) With '/ home / myUser coat / rdbmsdata.csv' = '';
COPY command for more information can be found.
is col1 (only) the primary key.
generated statement = Session.prepare ("myKeyspace.myColumnFamily UPDATE" + "SET col2 =?, Col3 =?" + "WHERE col1 =?"); Boundstatism bound condition = statement. Bind (stroke 2, stroke 3, stroke 1); Session.execute (boundStatement);
UPDATE and
INSERT adds a record if it does not exist and update it (effectively "UPSERT" Is known as). Supports columns from a
INSERT at a
UPDATE (if your schema is using them).
Comments
Post a Comment