For Cassandra Database , I run this command ;
export week='202328'
cqlsh -u $DSE_USERNAME -p $DSE_PASSWORD
-e "select backup_id,week,event_time,type,status from \"Opscenter_XXXXX\".backup_reports where week = '$week' and type='backup' LIMIT 1 ALLOW FILTERING ;" | tail -n +4 | head -n -2
Result is like that :
Opscenter_76a7068a-b567-4458-bdc8-3899253c32a2_2023-07-16-15-00-00-UTC | 202328 | 2023-07-16 15:00:00.000000+0000 | backup | success
I also want to same thing with remote server by ssh command like that :
export week='202328'
ssh -q -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o BatchMode=yes $user@$host ". .bash_profile ;cqlsh -u $user -p $password -e 'select backup_id,week,event_time,type,status from \"Opscenter_XXXXX\".backup_reports where week = **'$week'** LIMIT 1 ALLOW FILTERING ;' | tail -n +4 | head -n -2 > lastbackup.txt"
<stdin>:1:InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid INTEGER constant (202328) for "week" of type text"
OR
ssh -q -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o BatchMode=yes $user@$host ". .bash_profile ;cqlsh -u $user -p $password -e 'select backup_id,week,event_time,type,status from \"Opscenter_XXXX\".backup_reports where week = **$week** LIMIT 1 ALLOW FILTERING ;' | tail -n +4 | head -n -2 > lastbackup.txt"
<stdin>:1:InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid INTEGER constant (202328) for "week" of type text"
How could I solve this ?
Thank you