Hi Team
Â
I have a date datefield storing current datetime in it want to create a UUID using same column how i can create . currently using groovy script to create UUID but want to use same column and create itÂ
Hi Team
Â
I have a date datefield storing current datetime in it want to create a UUID using same column how i can create . currently using groovy script to create UUID but want to use same column and create itÂ
Â
kindly try this.
String timeuuid = com.datastax.driver.core.utils.UUIDs.timeBased().toString();
@bikram
 thanks for the response as always
Â
but before this am creating a dateinhour column to store current date and i want to use that column to generate UUID is that possible to pass that in parameter for above function ?
Â
I tried this in jython , kindly try it in your pipeline and let me know if it helps.
Â
from datetime import datetime
from uuid import uuid4
date_time = datetime.now().strftime('%Y%m-%d%H-%M%S')
eventid = date_time + str(uuid4())
for record in sdc.records:
 try:
  Â
  record.valueo'data'] = eventid
  # Write record to processor output
  sdc.output.write(record)
 except Exception as e:
  # Send record to error
  sdc.error.write(record, str(e))
Thanks possible to share solution using groovy stage? we are using same and other transformation also
  MessageDigest mac = MessageDigest.getInstance("SHA-256");
   byte ] signatureBytes = mac.digest(dateInHour.getBytes(StandardCharsets.UTF_8));
Â
   StringBuffer hexString = new StringBuffer();
   for (int j=0; j<signatureBytes.length; j++) {
   String hex=Integer.toHexString(0xff & signatureBytes j]);
   if(hex.length()==1) hexString.append('0');
   hexString.append(hex);
   }
Â
   String encryptedSignature = hexString.toString();
   String encryptHash = encryptedSignature.replace("-","");
   encryptHash = encryptHash.toUpperCase();
  Â
  record.value)'encryptHash']
  output.write(record)
Â
using ths but not able to get the output getting errorÂ
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.