File Format and Examples
If a file is used (-f option) to specify the tables to purge, the format of the file specified in the above point 4-b is as follows:
Each line in the text file contains five fields that are TAB separated.
The fields are:
tablename<TAB>columnname<TAB>additional key names<TAB>pk value<TAB>prk value
The following are the definitions of these fields.
- tablename : The name of the table from which data will be removed if it satisfies the criteria.
- columnname : The name of the column that holds the timestamp.
- additional key names : The name(s) of other columns that are part of the primary key until the column that holds timestamp. Each column name should be comma separated.
- pk value : Whether or not the column that holds timestamp is part of the partition key. 0 indicates no and 1 indicates yes.
- prk value : Whether or not the column that holds timestamp is a part of the Primary key. 0 indicates no and 1 indicates yes.
Important
A file table_specs.txt is included with the JAR that contains specifications for all the Workbench tables. This can be used to remove data from all Workbench tables. Some Examples
Example 1
Consider the following table definition:
CREATE TABLE act.alerts_triggered_by_call call_id uuid, alert_id uuid, alert_condition text, alert_timestamp timestamp, alert_type text, parameters map<text, text>, PRIMARY KEY (call_id, alert_id) ) WITH CLUSTERING ORDER BY (alert_id ASC)
The entry in the file for this would be:
act.alerts_triggered_by_call alert_timestamp call_id, alert_id no no
Since alert_timestamp is not part of the partition key, it is not a part of the primary key.
A sample of the command for this table would be:
java -jar DataPurgeUtility.jar -h 135.17.180.184 -p 9042 -d 30 -t act.alerts_triggered_by_call -c alert_timestamp -a "call_id,alert_id" -pk 0 -prk 0
Example 2
Consider the following table:
CREATE TABLE beholder.changes ( timemodified timestamp, dbid int, changekey text, changeby text, changetopobjectname text, changevalue text, objecthostip text, objecthostname text, operationtype text, PRIMARY KEY (timemodified, dbid, changekey) ) WITH CLUSTERING ORDER BY (dbid ASC, changekey ASC)
The entry in the file for this would be:
beholder.changes timemodified dbid,changekey yes yes
Since timemodified is a part of the partition key and it is a part of the primary key.
A sample of the command for this table would be:
java -jar DataPurgeUtility.jar -h 135.17.180.184 -p 9042 -d 30 -t beholder.changes -c timemodified -a "dbid,changekey" -pk 1 -prk 1
This page was last edited on November 29, 2019, at 14:41.
Comments or questions about this documentation? Contact us for support!